Skip to main content
reedomneck
Associate III
March 16, 2016
Question

SPMW01SA HTTP post with JSON format

  • March 16, 2016
  • 13 replies
  • 1822 views
Posted on March 16, 2016 at 16:03

Hi All,

For my project i am using SPMW01SA WiFi module and still we are in development stage so we are doing our R&D on STEVAL-IDI004v2 evaluation board.

STEVAL-IDI004v2 board WiFi is able to connect to internet and when we are trying to send sensor data to cloud WiFi module is responding back with arguments are missing. 

Our cloud is expecting data in JSON format and HTTP post method.

Can anyone please help me on this.

Regards,

--Manz

#https://my.st.com/public/ste2eco
    This topic has been closed for replies.

    13 replies

    Gerardo GALLUCCI
    ST Employee
    March 30, 2016
    Posted on March 30, 2016 at 10:39

    Flow,

    Minimal HTTP request MUSTinclude some required fields:

    GET / HTTP/1.1
    
    Host: www.example.com
    
    Connection: close
    
    
    
    

    HTTP version (1.1 here), and CrLfCrLf (2x) at the end, are mandatory. For your final step I suggest: - open a socket server on a PC (e.g.: nc -l 80) - use your tool to connect to this ''fake'' webserver You'll find on console how the request is formatted. Copy whole string inside HTTPREQ payload, and should be working. Bye j
    florian239955_st
    Associate III
    April 7, 2016
    Posted on April 07, 2016 at 07:25

    Hi Gerry,

    I get it... I had to add

    Host: www.example.com

    and use HTTP/1.1 instead of HTTPS/1.1 I will provide the example in the Android GCM thread. Thank you for your support. Regards, Flow
    Gerardo GALLUCCI
    ST Employee
    April 7, 2016
    Posted on April 07, 2016 at 08:19

    Hi Flow,

    As far as I know, 

    HTTPS/1.1 is wrong. Means nothing.

    The HTTP request is totally independent of the TLS encryption.

    Both HTTP and HTTPS begins with a TCP connection setup. When webserver receive a TCP connection request, it will request certificates to remote host. Then, after connection is created, ''strings'' are automatically encrypted/decrypted.

    So, ''GET HTTP/1.1'' will be an HTTPS GET.

    Minimal HTTP GET request MUST be well formatted

    Hope it's clear.

    Ciao

    j