New data stream
Request format: POST
URL: [http:// api.onenet.hk.chinamobile.com/devices/device_id/datastreams](
device_id: to be replaced with device ID
http body parameter
Name |
Format |
Required or not |
Description |
id |
string |
Yes |
Data stream ID, i.e. data stream name |
tags |
array- string |
No |
Data stream tag, one or more |
unit |
string |
No |
Data unit |
unit_symbol |
string |
No |
Data unit symbol |
cmd |
string |
No |
Periodically issued command, hexadecimal byte string. Example: 010300000002c40b. |
interval |
int |
No |
Sampling interval |
formula |
string |
No |
Register calculation formula Example: (A0+A1) means adding the value of the register 0 to that of register 1. |
Return Parameters
Name |
Format |
Description |
errno |
int |
Call error code, where 0 means success. |
error |
string |
Error description. “succ” means the call is successful. |
data |
json |
Device-related information returned after interface is successfully called. See the Data Description Table. |
Data Description Table
Name |
Format |
Description |
ds_uuid |
string |
Unique data stream ID within the platform |
POST http://api.onenet.hk.chinamobile.com/devices/20474930/datastreams HTTP/1.1
Request parameter example
{
"id": "speed",
"cmd": "010300000002c40b",
"interval": 10
}
Return Example
{
"errno":0,
"data": {
"ds_uuid":"856f8622-64e7-5549-8e55-44931f07db6e"
},
"error":"succ"
}