docs-v2/shared/text/api/v2.0/buckets/oss/create.js

30 lines
569 B
JavaScript
Raw Normal View History

/**
* Create a bucket with the InfluxDB 2.x API.
*/
const https = require('https');
function createBucket() {
const options = {
host: 'localhost:8086',
path: "/api/v2",
headers: {
'Authorization': 'Token YOUR_API_TOKEN',
'Content-type': 'application/json'
},
};
const request = https.get(options, (response) => {
let rawData = '';
response.on('data', () => {
response.on('data', (chunk) => { rawData += chunk; });
})
response.on('end', () => {
console.log(rawData);
})
});
request.end();
}