POST json data with BGS1 | Telit Cinterion IoT Developer Community
August 1, 2017 - 10:56pm, 1609 views
I'm struggling with the setup of the header contens for a POST to a server that uses Basic Authentication.
Using a browser tool (or CURL) I can post data to the server with success:
POST http://waterreport.co.za/api/reading
Authorization: Basic OmZzNEZkcmc1WGQ=
Content-Type: application/json
payload = {"serial": "123","transmitters": [{"ser": 123,"w_v": 276,"b_l": 60,"t_s": true,"p_s": true,"tsp": 1501009452}]}
The examples on the forum and Knowlagebase does not show how the header data is handeled.
(I'm using the AT commands to setup the HTTP internet server)
I can succsesfull GET and POST to a diffrent sever that does not require the Authenticaion or the json content.
Please advice?
Hello,
There are two ways for the http basic authentication.
1. You can use the user and passwd parameters of AT^SISS command to provide the user and password as plain text.
2. You can add Authorization: Basic... to the http header with hcProp parameter of AT^SISS command
Regards,
Bartłomiej