-
Notifications
You must be signed in to change notification settings - Fork 0
X bit API definition DOCUMENT
This doc is to define the RESTFul API of V1 x-bit

-
Register
POST https://hostname/rest/settings/register { "username": xxx, "password": xxx }ie:
https://52.197.83.138/rest/settings/register { "username": "robin.deng", "password": "xxxxxxxxxx" } -
Login:
POST https://hostname/rest/settings/login { "username": xxx, "password": xxx }Response:
{ "status": 200, "errmsg": "OK", "data": { "id": 1 } } -
List user Info: (We can use session or basic authentication)
GET https://hostname/rest/settings/user/<id> { "status": 200, "data": { "username": xxx, "userKeys": [ "key1", "key2", ... ] } } -
Update User Info
PUT https://hostname/rest/settings/user/<id> { "password": xxx, "userKeys": [ "key1", "key2", ... ] } -
Delete a user
DELETE https://hostname/rest/settings/user/<id> { "status": 200 }
-
raw data
GET https://hostname/rest/data/<key> { "status": 200, "message": "OK", "data": [ { "timestamp": xxxx, "location": { "lat": xxx, "lon": xxx, "speed": xxx, } } ] } -
upload data
POST https://hostname/rest/data/<key> [ { "timestamp": xxxx, "metrics": [{ "name": "metric1", "value": 123 }, ..., { "name": "metricN", "value": 789 }] } ] -
graph data
GET https://hostname/rest/data/<key> { "status": 200, "message": "OK", "data": [ { "timestamp": xxxx, "location": { "lat": xxx, "lon": xxx, "speed": xxx, } } ] }ie.
http://xbit:8080/rest/data/mobile-tracking {
"status": 200, "message": "OK", "data": [ { "id": "AVZQzCReGwcl3U52zroz", "timestamp": 1470234371135, "location": { "lon": 120, "lat": 42, "speed": 1 } }, { "id": "AVZQzCReGwcl3U52zro0", "timestamp": 1470234371136, "location": { "lon": 128, "lat": 46, "speed": 1 } }, { "id": "AVZQzCRgGwcl3U52zro5", "timestamp": 1470234371133, "location": { "lon": 118, "lat": 41, "speed": 1 } }, { "id": "AVZQzCRgGwcl3U52zro6", "timestamp": 1470234371135, "location": { "lon": 122, "lat": 43, "speed": 1 } }, { "id": "AVZQzCReGwcl3U52zroy", "timestamp": 1470234371137, "location": { "lon": 132, "lat": 48, "speed": 1 } }, { "id": "AVZQzCRfGwcl3U52zro2", "timestamp": 1470234371136, "location": { "lon": 130, "lat": 47, "speed": 1 } }, { "id": "AVZQzCRfGwcl3U52zro4", "timestamp": 1470234371138, "location": { "lon": 134, "lat": 49, "speed": 1 } }, { "id": "AVZQzCReGwcl3U52zro1", "timestamp": 1470234371112, "location": { "lon": 116, "lat": 40, "speed": 1 } }, { "id": "AVZQzCRfGwcl3U52zro3", "timestamp": 1470234371136, "location": { "lon": 126, "lat": 45, "speed": 1 } }, { "id": "AVZQzCReGwcl3U52zrox", "timestamp": 1470234371135, "location": { "lon": 124, "lat": 44, "speed": 1 } } ] }