cancel
Showing results for 
Search instead for 
Did you mean: 

SPWF01SA custom HTTP POST request Problem!

Archit Saraf
Associate
Posted on March 15, 2018 at 07:44

Hello and good day!

I'm attempting to use the SPWF01SA module with an STM32F0 microcontroller to post some data onto a remote web server. 

I have come to understand that the 

AT+S.HTTPPOST

 command can only post form data. However, my requirement is to post a JSON packet instead of form data. So, I'm using the 

AT+S.HTTPREQ

 command to send a custom POST request. However, the problem I'm facing is that I'm receiving only '\r' as response from the 

SPWF01SA module, on executing the 

AT+S.HTTPREQ

 command.

To walk through my steps, I'm first connecting to a WiFi network using all relevant commands, and am able to successfully receive the 'WIND:24' message from the module. After this, I'm sending the 

AT+S.HTTPREQ

 command to the module in the following format:

AT+S.HTTPREQ=

https://community.st.com/external-link.jspa?url=https%3A%2F%2Fwww.xxxx.com%2C80%2C1000%5Cr

POST /gaiahardsurveytest/v2/getHardSurveyData HTTPS/1.1\r\n

Host: SPWF01SA\r\n

Content-Type: application/json\r\n

Content-Length: 700\r\n

{JSON_PACKET}\r\n\r\n

I would like to make a special mention that I need to POST data to an HTTPS server, however, I've tried posting over HTTP as well, and have faced the same issue of not getting any reply from the SPWF01SA module beyond a '\r' which the module sends back instantly.

Please guide me, and tell me if I'm missing any steps or making any errors.

Thank you,

Archit

#spwf01sa #wifi #spwf01s
1 ACCEPTED SOLUTION

Accepted Solutions
Bernardo Almeida
Associate
Posted on April 01, 2018 at 03:30

The DataLen is very important.

Make sure the number of bytes sent is the same as the number you put in the request.

View solution in original post

1 REPLY 1
Bernardo Almeida
Associate
Posted on April 01, 2018 at 03:30

The DataLen is very important.

Make sure the number of bytes sent is the same as the number you put in the request.