|
|
|
# HowTo use REST/JSON
|
|
|
|
|
|
|
|
## simple send position data
|
|
|
|
PFAL command example
|
|
|
|
```
|
|
|
|
TCP.JSON.Flush,"http://testserver.com/json",0,":{\'LAT\':&(LastLat),\'LON\':&(LastLon),\'IMEI\':&(IMEI),\'IGN\':&(IO8)}"
|
|
|
|
```
|
|
|
|
HTTP POST
|
|
|
|
```
|
|
|
|
TBD
|
|
|
|
```
|
|
|
|
|
|
|
|
## REST specific PFAL commands
|
|
|
|
|
|
|
|
* command to sent HTTP REST with URL encodiong
|
|
|
|
TCP.Send.Rest,"<URL>",<enableBodyEncryption>,"<Parameter-String>"
|
|
|
|
+ <URL>: http:// must be included!; optional :<port_number> is possible
|
|
|
|
+ <enableBodyEncryption>: 0 - no encryption is used
|
|
|
|
+ <Parameter-String>: url-encoded key1=val1&key2=val2&..&key<n>=val<n>
|
|
|
|
|
|
|
|
* command to sent HTTP REST with JSON body
|
|
|
|
```
|
|
|
|
TCP.Send.JSON,"<URL>",<enableBodyEncryption>,"<Parameter-String>"
|
|
|
|
```
|
|
|
|
+ <URL>: http:// must be included!; optional :<port_number> is possible
|
|
|
|
+ <enableBodyEncryption>: 0 - no encryption is used
|
|
|
|
+ <Parameter-String>: have to start with { and end with }
|
|
|
|
key names have to enclosed by escaped character \'
|
|
|
|
between key and value the character : is required
|
|
|
|
values: strings have to enclosed by escaped
|
|
|
|
character \'
|
|
|
|
fractional numbers with . as separator
|
|
|
|
|
|
|
|
* new dynamic entry &(HttpResponse) - reports the last responded HTTP
|
|
|
|
status message/error code
|
|
|
|
|
|
|
|
* write command for Multi parameter JSON
|
|
|
|
```
|
|
|
|
TCP.JSON.Write,"<Parameter-String>"
|
|
|
|
```
|
|
|
|
write single data line to flash buffer for unsent msg, each with leading marker <d4fb>
|
|
|
|
|
|
|
|
* flush command for Multi parameter JSON
|
|
|
|
```
|
|
|
|
TCP.JSON.Flush,"<URL>",<enableBodyEncryption>,"<Parameter-String>"
|
|
|
|
```
|
|
|
|
send unsent data as MultiMsg JSON
|
|
|
|
<Parameter-String> : JSON with additional marker as placeholder
|
|
|
|
for stored single data lines {<optional additional JSON>,<d4fb>} |