10 years, 2 months ago.

HTTPClient - Headers and complex Post Data

Hi. I'm using HTTPClient library in mbed to do HTTP GET and POST calls. I want to follow this guide: http://www.sense-iot.com/using-api/getting-started/

I could already implement Step 2 Log In:

map.clear(); map.put("Accept", "application/json"); map.put("username", username); map.put("password", password); HTTPText inText(str, 512); ret = http.post("http://api.sense-os.nl/login", map, &inText);

In this case, Accept should be part of the Header, but it accepts as parameter like username and password.

Now I'm trying to implement Step 3 Create a Sensor, but first of all Accept and X-SESSION_ID must be part of the Header. How to distinguish Header and parameters? Next, I don't know how to send in HTTPClient library that complex Post Data shown in the guide. Any tip?

Thanks.

Be the first to answer this question.