InfluxDB API - write request to the cloud

Hello togehter,

I want to use the API to write data from a datalogger (IOT) to the InfluxDB Cloud… I have only limited rights at the logger, so I can’t install at this edge the telegraf. But I got a description how to write the data with the API directly to the InfluxDB. The problem is that the description is assuming to write the the data to a raspberry pi with InfluxDB OSS. But I want to have the data send to the InfluxDB cloud and got a failure message.

I used this code to write (as described on the documentation)

curl -XPOST “https://eu-central-1-1.aws.cloud2.influxdata.com/api/v2/write?org=YOURORG&bucket=YOURBUCKET&precision=s” --header “Authorization: Token YOURTOKEN” --data-raw “temperture_in_room, room=kitchen temp=19.5”

I got following failure message…
curl: (60) server certificate verification failed. CAfile: none CRLfile: none
More details here: https://curl.haxx.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.

Does anyone had similar failue and know a solution?

Greetings
Ehninchr

Hello @Ehninchr,
Welcome! Cool project! What type of data are you writing to Cloud? Want to tell me more? Sounds interesting.
That’s a strange error. I’m not sure this would help, but it looks like your line protocol is off–try removing the space after the measurement name:

 -data-raw “temperture_in_room,room=kitchen temp=19.5”*

Or for a complete example:
https://docs.influxdata.com/influxdb/v2.0/write-data/developer-tools/api/

Hello Anaisdg,

I tried to update the line protocol, but it was not sucessfull… still the same failure message. I tried the same command also with a raspberry. Did you tried that command with the cloud - is it working for you?

I thought about that may there would be a CA-File and CRL-File that I have to download from AWS and install at the datalogger.

Greetings
Christian

@Ehninchr, you can add -k or --insecure option for curl to skip certificate validation.

Hello @VlastaHajek,

thanks a lot… with that -k or -insecure option it was working. I guess there wouldn’t be a secure option to upload with the api to influxDB cloud on AWS.

Greetings
Ehninchr

Hello @VlastaHajek, Hello @Anaisdg,

I found in the documentation that the cloud enforce TLS encryption for data in… if I use “-k” option for the API write “-curl” function. Does that means that its still TLS?


https://docs.influxdata.com/influxdb/cloud/reference/internals/security/#data-encryption

Greetings
Christian