X bit API definition DOCUMENT - lm-xbit/monitor-platform GitHub Wiki
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": { "latitude": xxx, "longitude": xxx, "altitude": xxx, "accuracy":xxx } } ] }GET https://hostname/rest/data/<key>?from=1472719254000&to=1472719354000&aggs=3 { "status": 200, "message": "OK", "data": [ { "timestamp": xxxx, "location": { "latitude": xxx, "longitude": xxx, "altitude": xxx, "accuracy":xxx } } ] }from: it's the start timestamp you want to get the aggregation data to: the end timestamp you want to get the aggregation data aggs: the aggregation time in minute, ie. is aggs=3, then it means that all the data in 3 minutes will be aggregate to only one data
-
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": { "latitude": xxx, "longitude": xxx, "altitude": xxx, "accuracy":xxx } } ] }