Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
W wiki
  • Project overview
    • Project overview
    • Details
    • Activity
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
Collapse sidebar
  • pub
  • wiki
  • Wiki
  • avl_rest_json_howto

Last edited by Saleh Mohamad Feb 14, 2018
Page history
This is an old version of this page. You can view the most recent version or browse the history.

avl_rest_json_howto

HowTo use REST/JSON

REST specific PFAL commands

  • command to sent HTTP REST with URL encodiong TCP.Send.Rest,"",,""

    • : http:// must be included!; optional :<port_number> is possible
    • : 0 - no encryption is used
    • : url-encoded key1=val1&key2=val2&..&key=val
  • command to sent HTTP REST with JSON body

TCP.Send.JSON,"<URL>",<enableBodyEncryption>,"<Parameter-String>"
  • : http:// must be included!; optional :<port_number> is possible
  • : 0 - no encryption is used
  • : 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

  • flush command for Multi parameter JSON
TCP.JSON.Flush,"<URL>",<enableBodyEncryption>,"<Parameter-String>"

send unsent data as MultiMsg JSON : JSON with additional marker as placeholder for stored single data lines {,}

EXAMPLE

simple send position data

PFAL command example

PFAL command example to write JSON data (executed multiple times)

$PFAL,TCP.JSON.Write,"{
<d4fb>\'&(Date)_&(Time)\':{\'IMEI\':&(IMEI),\'AI1\':&(IN1)}}"

PFAL command example to flush

$PFAL,TCP.JSON.Flush,"http://59.181.166.3:47000/demo/telematics",0,"{\'KEY\':\'&(Date)_&(Time)\',\'MOVELETKEY\':\'blackbox-fox3\',\'ACK\':\'SUCCESS\',\'PARTICIPANTKEY\':\'&(Date)_&(Time)\',<d4fb>}"

HTTP POST

POST /demo/telematics HTTP/1.0
HOST: 59.181.166.3..User-Agent:AVLemb/2.13
Content-Type: application/json; charset=ISO-8859-1
FAL-IMEI: 353816054730215..FAL-ENCRYPTION: 1
Content-Length: 776

{"KEY":"06.01.1980_00:09:21","MOVELETKEY":"blackbox-fox3","ACK":"SUCCESS","PARTICIPANTKEY"
:"06.01.1980_00:09:21",
"06.01.1980_00:01:00":{"LAT":0.0000000,"LON":0.0000000,"IMEI":353816054730215},
"06.01.1980_00:01:01":{"LAT":0.0000000,"LON":0.0000000,"IMEI":353816054730215},
"06.01.1980_00:01:38":{"LAT":0.0000000,"LON":0.0000000,"IMEI":353816054730215},
"06.01.1980_00:02:56":{"LAT":0.0000000,"LON":0.0000000,"IMEI":353816054730215},
"06.01.1980_00:03:15":{"LAT":0.0000000,"LON":0.0000000,"IMEI":353816054730215},
"06.01.1980_00:03:26":{"LAT":0.0000000,"LON":0.0000000,"IMEI":353816054730215},
"06.01.1980_00:04:09":{"LAT":0.0000000,"LON":0.0000000,"IMEI":353816054730215}
}  

PFAL command example to send JSON data

$PFAL,TCP.JSON.Send,"http://62.91.82.12:4451/dashboard/info.php",0,"{\'title\':\'FOX3 sends JSON message directly\',\'body\':\'IMEI\':&(IMEI),\'IGN\':&(IO8),\'Lat\':&(Lat),\'Lon\':&(Lon),\'Spd\':&(Speed.kmh)km/h,\'Power\':&(Power)V,\'}"
HTTP POST

POST /dashboard/info.php HTTP/1.0 HOST: 62.91.82.12 User-Agent: AVL/3.0 Content-Type: application/json; charset=utf-8 Content-Length: 149

{ "title": "FOX3 sends JSON message directly", "body": "IMEI": 359486060345574, "IGN": 1, "Lat": 50.6734740, "Lon": 10.9809194, "Spd": 0.04km/h, "Power": 15.149V, "}

Clone repository
  • AVL Filesystem
  • BOLERO40_GNSS_improvement
  • BOLERO40_improvement_of_the_GNSS_performance
  • NFC_commands,_event,_dynamic_variable
  • Promotion_Kit_Settings
  • Workbench Mac Installation Readme
  • avl_aes_key_handling
  • avl_ble
  • avl_blueid
  • avl_config_commented_1
  • avl_ecodrive
  • avl_feature_list
  • avl_frp_main
  • avl_fw_update
  • avl_premium_feature_cpc
View All Pages