Search code examples
at-commandgprssim900

sending Json data to server using AT commands


I am having a website which accepts json data with post method.It works fine when i try sending the request from POSTMAN rest client. When i am trying to the same using AT commands its failing.

enter image description here

This is the AT sequence i tried

AT
AT+CREG? 
AT+CGATT?
AT+CIPSHUT
AT+CIPSTATUS
AT+CIPMUX=0 
AT+CGDCONT=1,"IP","airtelgprs.com"
AT+CSTT="airtelgprs.com"
AT+CIICR
AT+CIFSR
AT+CIPSTATUS
AT+CIPSTART= "TCP","obdsam.herokuapp.com","80"
AT+CIPSEND
>
POST /newtasks HTTP/1.1 (Ctrl+M + Ctrl+J)
HOST: obdsam.herokuapp.com" (Ctrl+M + Ctrl+J)
Accept: application/json (Ctrl+M + Ctrl+J)
Content-Type: application/json (Ctrl+M + Ctrl+J)
{"RPM":"41","ECT":"20"} (Ctrl+M + Ctrl+J)
(ctrl+j)(ctrl+z)

What could be the issue?

This is the reply from serial terminal

enter image description here


Solution

  • Solved the issue. After AT+CIPSEND the message must be like this >

    POST /newtasks HTTP/1.1 (Ctrl+M + Ctrl+J)
    HOST: obdsam.herokuapp.com (Ctrl+M + Ctrl+J)
    Accept: application/json (Ctrl+M + Ctrl+J)
    Content-Type: application/json(Ctrl+M + Ctrl+J)
    Content-Length: 23 (Ctrl+M + Ctrl+J) (Ctrl+M + Ctrl+J)
    {"RPM":"55","ECT":"55"} (Ctrl+M + Ctrl+J)(ctrl+j)(ctrl+z)