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.
Locked
User avatar
rk_ramkishor
 
Posts: 1
Joined: Wed Mar 31, 2021 8:11 am

USING POST REQUEST USING ADAFRUIT..IO API

Post by rk_ramkishor »

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"

User avatar
brubell
Learn User Page
 
Posts: 2010
Joined: Fri Jul 17, 2015 10:33 pm

Re: USING POST REQUEST USING ADAFRUIT..IO API

Post by brubell »

Are you following an example from somewhere?

Locked
Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.

Return to “Internet of Things: Adafruit IO and Wippersnapper”