can't update fields in my channels | ESP Wi-Fi | Forum


Please consider registering

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —

— Match —

— Forum Options —

Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
can't update fields in my channels
No permission to create posts
July 17, 2018
12:27 pm
New Member
Forum Posts: 2
Member Since:
July 17, 2018
sp_UserOfflineSmall Offline

hi ,
i'm using esp-01s wifi module with my tm4c123gh microcontroller to upload temperature values to my channel.
i'm using this get request "GET /update?api_key=MY_api_key&field1=%d HTTP/1.1

" to update my field1 , but i'm getting this 400 bad request
here is a screenshot of the server response:

Recv 89 bytes


+IPD,598:HTTP/1.1 400 Bad Request
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: close
Status: 400 Bad Request
X-Frame-Options: ALLOWALL
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PUT, OPTIONS, DELETE, PATCH
Access-Control-Allow-Headers: origin, content-type, X-Requested-With
Access-Control-Max-Age: 1800
Cache-Control: no-cache
X-Request-Id: 26f0dc6f-7e57-4dff-99cc-7873010867a5
X-Runtime: 0.004454
X-Powered-By: Phusion Passenger 4.0.57
Date: Tue, 17 Jul 2018 15:57:04 GMT
Server: nginx/1.9.3 + Phusion Passenger 4.0.57




i'm using these 2 methods to make a tcp connection with the server :

// Establish TCP connection
// Input: IP address or web page as a string
// output: 1 if success, 0 if fail
int ESP8266_MakeTCPConnection(char *IPaddress){
int try=MAXTRY;
sprintf((char*)TXBuffer, "AT+CIPSTART=\"TCP\",\"%s\",80
", IPaddress);
ESP8266SendCommand(TXBuffer); // open and connect to a socket
if(SearchFound) return 1; // success
return 0; // fail

// Send a TCP packet to server
// Input: TCP payload to send
// output: 1 if success, 0 if fail
int ESP8266_SendTCP(char* fetch){
volatile uint32_t time,n;
sprintf((char*)TXBuffer, "AT+CIPSEND=%d
", strlen(fetch)+2);
n = 8000;
time = (75825*8)/91; // 1msec, tuned at 80 MHz
if(ServerResponseSearchFinished==0) return 0; // no response
return 1; // success
i can read data from thingspeak ,but i can not write data

July 17, 2018
7:53 pm

Forum Posts: 861
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

You should consider using the ThingSpeak communication library for arduino and ESP. There are good examples in the documentation that show you how to use it. Foe example,

Or you can use the wifi library and create the post or GET commands yourself, as in this example.

These examples show that they are compatible with esp8266-12, but the code will work for ESP8266-01 as well, just not the rest of the example (hardware parts like ADC are needed) I will consider updating that list of supported hardware to say this.

If there is some reason you absolutely need to use the AT command set, please let me know and I will try to help you debug the method above. However, I really think you can make it much easier on yourself with the other two methods.

July 18, 2018
5:31 pm
New Member
Forum Posts: 2
Member Since:
July 17, 2018
sp_UserOfflineSmall Offline

cstapels thank you for your response
but i'm afraid that the two methods won't work with me as i'm using the ARM-CORTEX-M4 with the ESP8266-01.
i have tried to customize the library to support that hardware ,but that needs time i don't have ,so i have to absolutely use the AT command set.
it would be great if you could help me with that

thanks again ,

July 19, 2018
2:27 pm

Forum Posts: 861
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

Ok. AT challenge accepted.
But one last ditch effort - you could communicate to the ESP via serial from the cortex.
you wait for events
if ( ESPserial.available() )
{ save the text you get over serial
set flag NEW_DATA=true}

and then once an event is recieved, you can use the wifi library commands to send data to thingspeak:

write to thingspeak;

all this is programmed in the ESP using the arduino IDE and you program in C.

But, back to your problem above. First, I would make sure you can update your channel in a web browser with the get command you are showing above
GET /update?api_key=MY_api_key&field1=%d

I'd put the server in directly and hard code the data just for testing.
try it in the browser just to make sure the syntax is correct and then try it in your code.

if you are getting a 400 error, it may mean you are connected to ThingSpeak but you just have the syntax or api key wrong.

since the read works, I suspect your connection is fine, its just the syntax for the write command.

If that's not it, we can look into how you determine the byte size to send, but It looks initially ok. Let me know if you can update from the browser.

Forum Timezone: America/New_York

Most Users Ever Online: 166

Currently Online:
17 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 272

Vinod: 240

piajola: 95

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 8665

Moderators: 1

Admins: 2

Forum Stats:

Groups: 3

Forums: 14

Topics: 1600

Posts: 5760

Newest Members:

briskpanda, Dejw0089, Yassine Ben Salah, anis, 43994554AKS, suda

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457