i try to replicate this code in a simple nodejs code
curl -XPOST "http://localhost:9999/api/v2/write?org=YOUR_ORG&bucket=YOUR_BUCKET&precision=s" \
--header "Authorization: Token YOURAUTHTOKEN" \
--data-raw "mem,host=host1 used_percent=23.43234543 1556896326"
const axios = require('axios')
const qs = require('qs')
async function influxd(){
const options = {
url: 'http://ec2-public-ip:9999/api/v2/write?org=something&bucket=something&precisions=s',
method: 'POST',
headers: {
'Authorization': 'Token 1LNrO7r1NPWDAwYtZpl-0Zd1EjSSwPhimoKZ8PUcTSbFFhqCIUUjYVYIA6ReFfqYUMuqpIPF1x33-pCcsp99fA==',
'Content-Type': "text/plain; charset=utf-8"
},
timeout: 0,
'body': qs.stringify('cpu,host=host1 usage_user=3.8234,usage_system=4.23874 1556892726597397000')
}
const response = await axios(options).catch(error=>console.log(error))
return response
}
and i receive this error
data: { code: 'invalid', message: 'writing requires points' } },
what i’m doing wrong?