Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By ocb00999
#17422 Has any one succeeded in sending POST request to HTTP server using AT command?

I tried the following but it seems doesn't work.
The Post request is:
POST /sensor HTTP/1.1
X-Parse-REST-API-Key: supersecretapikey
Content-Type: application/json
Host: ohomesensor.parseapp.com
Content-Length: 40

{"identifier":"washer","state":true}

I send AT command to my esp through arduino:
AT+CIPSTART="TCP","ohomesensor.parseapp.com",80
AT+CIPSEND=149
(wait for return of ">")
POST /sensor HTTP/1.1/r/nHost: ohomesensor.parseapp.com/r/nContent-Type: application/json /r/nContent-Length: 39/r/n/r/n{"identifier":"washer", "state":true}

I get response SEND OK, but in the server side I receive nothing.
I have tested post request using online tool, and it worked. The only problem I think is the AT command.
I can do GET request with the AT command, but not the POST request.
I have also modified the TX RX buffer size of my arduino to 256.
Any help is greatly appreciated.
User avatar
By JustMeHere2
#17477 I doubt it is the AT command set. It should have nothing to do with what actually gets sent. You just tell it you're sending xx bytes.

Your string is 158 characters as posted on this thread. Don't forget the \r\n which will be appended.
User avatar
By ocb00999
#17490 Sorry for the mistake, but in code I actually do it as

Serial.print("AT+CIPSEND=");
Serial.println(postData.length()); //the total length of the command to send
Serial.print(postData);

So I guess the problem doesn't lie in the number of characters.

JustMeHere2 wrote:I doubt it is the AT command set. It should have nothing to do with what actually gets sent. You just tell it you're sending xx bytes.

Your string is 158 characters as posted on this thread. Don't forget the \r\n which will be appended.