Quantcast
Channel: ThingSpeak IoT Community - All Forums
Viewing all articles
Browse latest Browse all 1833

cstapels on Cannot connect to ThingSpeak

$
0
0

You might consider trying your HTTP request in POSTMAN first, just to get the syntax correct.  I think the issue is in this section:

if (client.connect(server, 80)) { // "184.106.153.149" or api.thingspeak.com
String postStr = apiKey;
postStr += "&field1=";
postStr += String(flogal);
....

your "postStr" should start with a string that says "api_key=" and then append the api_key. You want postStr="api_key=XXXXXXXXXXXXXXXX&field1=<VALUE>"

For some hints, you might look at Continuously Collect Data and Bulk-Update a ThingSpeak Channel Using an Arduino MKR1000 Board or an ESP8266 Board, but keep in mind this syntax is for a bulk update which slightly different.

You also have the line "client.print("X-THINGSPEAKAPIKEY: " + apiKey + " 

You can safely keep this line, but you do not need to have the api key in both the header section and the body.  


Viewing all articles
Browse latest Browse all 1833

Trending Articles