Write to Influxdb error

I am trying to write data to influx from Fibaro using the v2 API. With 1.8 version of Influxdb the connection can work but with v2 not.
I still want to resolve in v2 rather than downgrade. But maybe later give up and ending in 1.8:)

As far as I know user and password not enough since the organization and token concept has been introduced in v2 API. Hence I rewrote the url and now it is: [DEBUG] 18:24:19: 192.168.1.124:8086/api/v2/write?org=fibaro&bucket=fibaro3&precisions=s

And the token is also provided as a parameter in the header: – [“Authorization”] = "Authothorization: Token " … deviceToken,

Still having issue and I think this is not because of theauthentication (yet) When the function called “sendDataToInflux(body)” then I get

[DEBUG] 18:26:14: 2021-04-26 18:26:14.191664 [ fatal] Unknown exception: std::runtime_error: ‘Invalid argument’

My body also looks ok:

[DEBUG] 18:26:14: Body: fibaro,sectionName=Outside,deviceID=105,roomName=Outside,deviceName=WindSpeed\ (km/h) value=2.5678057167419 1.619454374e+18

Any suggestion what argument can cause the problem? I created a brand new bucket (fibaro3) in influx to feed tha data to.

Hello @1forrest,
Just to make sure I’m understanding you correctly, you’re trying to write data to v2 with the v2 api and encountering problems?
Just to double check your header should include the word Token with a space and then your actual token like

--header "Authorization: Token <YOURAUTHTOKEN>" \

Finally, I notice that your timestamp in the line protocol you sent looks odd.
It should be a unix timestamp in nanosecond precision.

Have you had success with a cURL request?

Hi!

Yes, I am trying to write data to V2 with API. The source is Fibaro smarthome system.

I have adjusted the url because the “http” was missing. The token was also not good because could not write to bucket, so changed. And also changed the timastamp. Now finally I have a 204 response. But there is nothing in the bucket. It is empty. As far as I know the 204 should mean that data write to bucket was successful. When I go to Influxdb and explore the bucket “fibaro3” there is no data.
Any idea why I cannot see anything? See the response I got:

[DEBUG] 23:23:14: {“status”:204,“headers”:{“Connection”:“close”,“Date”:“Wed, 28 Apr 2021 21:23:14 GMT”},“data”:""}
It looks all good.

I tried the CURL. In windows cmd putting the curl code, I got the below error:

The problem was the date I provided that was the reason it was not showing up. I removed the “precision” from the URL and I also removed sending the date in the body. With that Influx defaults the time stamp. Which works fine form me now.
I tried to play with the precision and time format I provided but even when I changed the precision to “ns” or “S”, etc, the data was not written to Influx.