-->
Page 1 of 3

AT Command for sending POST request

PostPosted: Thu May 14, 2015 11:29 pm
by ocb00999
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.

Re: AT Command for sending POST request

PostPosted: Fri May 15, 2015 9:36 am
by JustMeHere2
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.

Re: AT Command for sending POST request

PostPosted: Fri May 15, 2015 11:31 am
by ocb00999
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.

Re: AT Command for sending POST request

PostPosted: Fri May 15, 2015 4:04 pm
by eriksl
Baud rate mismatch, transmission errors?