0

USING POST REQUEST USING ADAFRUIT..IO API
Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Please be positive and constructive with your questions and comments.

USING POST REQUEST USING ADAFRUIT..IO API

by rk_ramkishor on Sat Apr 03, 2021 5:23 am

client.print(String("POST ") + url + " HTTP/1.1\r\n" +
"Host: " + host + "\r\n" +
"Content-Type: application/json\r\n" +
"User-Agent: BuildFailureDetectorESP8266\r\n" +
"Content-Length: 0\r\n" +
"X-AIO-Key: "MY_KEY"\r\n" +
"Connection: close\r\n\r\n");

I have been using the above to POST my data. I am not sure where do I need to put the Body so as to store my value.
I tried to put it as below bu did not work.

"Connection: close\r\n\r\n{\"value\" :\"ON\"}");

I get the below error when I make an HTTP request.
"error": "request failed - failed to save data to feed 51jj. param is missing or the value is empty: datum"

rk_ramkishor
 
Posts: 1
Joined: Wed Mar 31, 2021 8:11 am

Re: USING POST REQUEST USING ADAFRUIT..IO API

by brubell on Mon Apr 05, 2021 9:25 am

Are you following an example from somewhere?

brubell
 
Posts: 1381
Joined: Fri Jul 17, 2015 10:33 pm

Please be positive and constructive with your questions and comments.