Addition of new data point
Request format: POST
URL: http://api.onenet.hk.chinamobile.com/devices/device_id/datapoints
device_id: to be replaced with device ID
URL Parameters
Name |
Format |
Required or not |
Description |
type |
string |
No |
Data format, complete JSON type by default (see the example) |
http body parameter
Name |
Format |
Required or not |
Description |
datastreams |
array- json |
Yes |
Json array of data stream information of device, see Datastreams Description Table |
Datastreams Description Table
Name |
Format |
Required or not |
Description |
id |
string |
Yes |
Name of data stream or data stream template |
datapoints |
array- json |
Yes |
Data point. Multiple data streams can be uploaded to the device cloud at a time. Each data stream may contain several data points. See the description table of datapoints. |
Datapoints Description Table
Name |
Format |
Required or not |
Description |
at |
date |
No |
Upload the data point time. If it is null, the current time will be taken by the device cloud. Others must be in the format of “YYYY-MM-DDThh:mm:ss” (e.g. 2015-03-22T22:31:12). |
value |
string/int/json... |
Yes |
Data value |
POST http://api.onenet.hk.chinamobile.com/devices/2*****30/datapoints HTTP/1.1
Request parameter example
{
"datastreams": [{
"id": "temperature",
"datapoints": [{
"at": "2013-04-22T00:35:43",
"value": "bacd"
},
{
"at": "2013-04-22T00:55:43",
"value": 84
}
]
},
{
"id": "key",
"datapoints": [{
"at": "2013-04-22T00:35:43",
"value": {
"x": 123,
"y": 123.994
}
},
{
"at": "2013-04-22T00:35:43",
"value": 23.001
}
]
}
]
}
Return Example
{
"errno": 0,
"error": "succ"
}