Home/Support/Support Forum/unable to construct XBEE 3G IPv4 payload

unable to construct XBEE 3G IPv4 payload

0 votes
Hi

so I am using XBEE 3G to send data as JSON to a PostgreSQL database on AWS using TX IPv4
however, I don't know how to construct the payload
the example provided by digi consists of simple HTTP GET
what I want is HTTP POST and other parameters like host, key, etc...
also how to wite the data in JSON format

Regards
asked Nov 30, 2017 in XBee Cellular by ad0rs New to the Community (0 points)

Please log in or register to answer this question.

1 Answer

0 votes
The HTTP Post and Get are very similar.

For example, this is an example from Mozilla for a POST.


POST /test.html HTTP/1.1
Host: example.org
Content-Type: multipart/form-data;boundary="boundary"

--boundary
Content-Disposition: form-data; name="field1"

value1
--boundary
Content-Disposition: form-data; name="field2"; filename="example.txt"

value2
answered Nov 30, 2017 by mvut Veteran of the Digi Community (12,791 points)
Hi
thanks for answering
I know how to create a simple POST request
my problem is:
1- how to do the authentication with the database?
2- how to post in JSON format
For the authentication side, try something like http://username:password@example.com/

As for the JSON, as far as the radio is concerned, it is nothing more than data. You simply save the file as you desire and send it just like any other file.
To make this more clear, the radio does not have a file system or support different languages. It can do simple POSTS, GETS Etc. But if you want to do more ,then you need to include the desired functions or code within your application.
...