D2Sphere Device Server REST API
Swagger Doc on EVAL
http://eval.d2sphere.com:9099/rest/ds/v1/swagger-ui.html
Online JSON en/decoder
https://www.freeformatter.com/url-encoder.html#ad-output
API for D2Sphere Device Data Push
- go to D2Sphere account and enable device data push
- setup HTTP(S) REST JSON target URL
sample data format
simple position data
PFAL command
$PFAL,TCP.Client.Send,8,"<sfal.pos>"
HTTP POST
POST /n4_test HTTP/1.1
Content-Length: 668
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Host: api.d2sphere.com:3333
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.3.5 (java 1.5)
data=%7B%0A++%22keyvalues%22%3A+%7B%7D%2C%0A++%22transmissionid%22%3A+35600060%2C%0A++%22imei%22%3A+352254060257307%2C%0A++%22transmissiontimestamp%22%3A+1507797693982%2C%0A++%22content%22%3A+11%2C%0A++%22source%22%3A+0%2C%0A++%22valid%22%3A+true%2C%0A++%22history%22%3A+false%2C%0A++%22gps%22%3A+%7B%0A++++%22gpstimestamp%22%3A+1507797683000%2C%0A++++%22fix%22%3A+true%2C%0A++++%22lastvalid%22%3A+false%2C%0A++++%22latitude%22%3A+5040.4035%2C%0A++++%22longitude%22%3A+1058.8453%2C%0A++++%22speed%22%3A+0.005144%2C%0A++++%22heading%22%3A+10.0%2C%0A++++%22altitude%22%3A+0.0%2C%0A++++%22transmissionid%22%3A+35600060%2C%0A++++%22imei%22%3A+352254060257307%0A++%7D%0A%7D
JSON DATA
data={
"keyvalues": {},
"transmissionid": 35600060,
"imei": 352254060257307,
"transmissiontimestamp": 1507797693982,
"content": 11,
"source": 0,
"valid": true,
"history": false,
"gps": {
"gpstimestamp": 1507797683000,
"fix": true,
"lastvalid": false,
"latitude": 5040.4035,
"longitude": 1058.8453,
"speed": 0.005144,
"heading": 10.0,
"altitude": 0.0,
"transmissionid": 35600060,
"imei": 352254060257307
}
}
position data + key/value
PFAL command
$PFAL,TCP.Client.Send,8,"<sfal.event.text text='n4 test test' key1='value1' key2='key2 value' key3='value3'>"
HTTP POST
POST /n4_test HTTP/1.1
Content-Length: 1468
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Host: api.d2sphere.com:3333
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.3.5 (java 1.5)
data=%7B%0A++%22keyvalues%22%3A+%7B%0A++++%22key1%22%3A+%7B%0A++++++%22value%22%3A+%22value1%22%2C%0A++++++%22transmissionid%22%3A+35600205%2C%0A++++++%22imei%22%3A+352254060257307%0A++++%7D%2C%0A++++%22key2%2
2%3A+%7B%0A++++++%22value%22%3A+%22key2+value%22%2C%0A++++++%22transmissionid%22%3A+35600205%2C%0A++++++%22imei%22%3A+352254060257307%0A++++%7D%2C%0A++++%22key3%22%3A+%7B%0A++++++%22value%22%3A+%22value3%22%2C
%0A++++++%22transmissionid%22%3A+35600205%2C%0A++++++%22imei%22%3A+352254060257307%0A++++%7D%0A++%7D%2C%0A++%22transmissionid%22%3A+35600205%2C%0A++%22imei%22%3A+352254060257307%2C%0A++%22transmissiontimestamp
%22%3A+1507798419345%2C%0A++%22content%22%3A+27%2C%0A++%22source%22%3A+0%2C%0A++%22valid%22%3A+true%2C%0A++%22history%22%3A+false%2C%0A++%22gps%22%3A+%7B%0A++++%22gpstimestamp%22%3A+1507798409000%2C%0A++++%22f
ix%22%3A+true%2C%0A++++%22lastvalid%22%3A+false%2C%0A++++%22latitude%22%3A+5040.3899%2C%0A++++%22longitude%22%3A+1058.8399%2C%0A++++%22speed%22%3A+0.015431999999999998%2C%0A++++%22heading%22%3A+10.0%2C%0A++++%
22altitude%22%3A+0.0%2C%0A++++%22transmissionid%22%3A+35600205%2C%0A++++%22imei%22%3A+352254060257307%0A++%7D%2C%0A++%22event%22%3A+%7B%0A++++%22noticed%22%3A+false%2C%0A++++%22eventtimestamp%22%3A+15077984090
00%2C%0A++++%22type%22%3A+%22EVENT%22%2C%0A++++%22subtype%22%3A+%22text%22%2C%0A++++%22message%22%3A+%22n4+test+test%22%2C%0A++++%22transmissionid%22%3A+35600205%2C%0A++++%22imei%22%3A+352254060257307%0A++%7D%
0A%7D
JSON DATA
data={
"keyvalues": {
"key1": {
"value": "value1",
"transmissionid": 35600205,
"imei": 352254060257307
},
"key2: {
"value": "key2 value",
"transmissionid": 35600205,
"imei": 352254060257307
},
"key3": {
"value": "value3",
"transmissionid": 35600205,
"imei": 352254060257307
}
},
"transmissionid": 35600205,
"imei": 352254060257307,
"transmissiontimestamp": 1507798419345,
"content": 27,
"source": 0,
"valid": true,
"history": false,
"gps": {
"gpstimestamp": 1507798409000,"fix": true,
"lastvalid": false,
"latitude": 5040.3899,
"longitude": 1058.8399,
"speed": 0.015431999999999998,
"heading": 10.0,altitude": 0.0,
"transmissionid": 35600205,
"imei": 352254060257307
},
"event": {
"noticed": false,
"eventtimestamp": 1507798409000,
"type": "EVENT",
"subtype": "text",
"message": "n4 test test",
"transmissionid": 35600205,
"imei": 352254060257307
}
}