cache command-write device resource/ Write
Request format: POST
URL: http(s)://api.heclouds.com/nbiot/offline
I only want to see examples!!!
Url parameter
Parameter Name | Format | Required? | Description |
imei | string | Yes | Identity code of nbiot device, required |
obj_id | int | Yes | Object id of device, equivalent to the data flow id in the platform model, required |
obj_inst_id | int | Yes | nbiotid of a specific instance under nbiot device object, id of instance, corresponding to a part of key value at the data point in the platform model, required |
mode | int | Yes | write mode; it can only be 1 or 2. |
valid_time | string | No | Command effective time, optional (When it’s left blank, it’s the current time of OneNET by default); when it’s filled in, it shall be bigger than the current time of OneNET server. |
expired_time | string | Yes | Command expiration time stamp, required, bigger than val |
retry | int | No | Between [0-10]; times of retry after failure (waiting for the device update or online next time), optional (when left blank, 3 by default); when it’s filled in, it shall be between [0, 10]. |
timeout | int | No | NoExpiration time; when it’s filled in, it shall be between [5, 40]s; when left blank, it’s 25s by default. |
trigger_msg | int | No | Command trigger uplink message type; when it’s filled in, it shall be between [1, 7]; when left blank, it’s 7 by default. |
http request parameter
Parameter Name | Format | Required? | Description |
data | array-json | 是 | json data array of write device resource, size restricted to be 2k; see data request parameter description list. |
data request parameter description list
Parameter Name | Format | Required? | Description |
res_id | int | Yes | Resource id of nbiot device |
type | int | No | Support 1 and 2 at present;1 means the resource type is Opaque; in such a case, val field is the hexadecimal character string corresponding to the binary system. 2 means the resource type is Time; in such a case, val field is the time stamp (expressed in seconds, value); If it’s left blank, it means the resource type is the basic data type. |
val | object | Yes | Value, can be boolean, string, long, double |
Return Parameters
Name | Format | Description |
errno | int | Call error code, where 0 means success. |
error | string | Error description, where "succ" means success. |
data | json | Device dependent message returned after the interface is successfully invoked; see Data Description Table |
Data Description Table
Name | Format | Description |
uuid | string | Cache command uuid |
Description
Return to the meaning corresponding to errno status code; check API status code.。
trigger_msg Trigger type:
1. REGISTER
2. UPDATE
3. REGISTER | UPDATE combination
4. NOTIFY
5. REGISTER | NOTIFY combination
6. UPDATE | NOTIFY combination
7. NOTIFY | UPDATE | REGISTER combination
请求示例
POST http://api.heclouds.com/nbiot/offline?imei=86582003***&valid_time=2016-08-05T08:00:00&expired_time=2016-08-06T08:00:00&obj_id=1212&obj_inst_id=1212&mode=1 HTTP/1.1
api-key: WhI*************v1c= //Must be MasterKey, because it involves personal privacy, use "*******" instead
Content-Type: application/json
Example of request parameter
Non-opaque type:
{
"data":[
{
"res_id":12,
"val":121
}
]
}
opaque type:
{
"data":[
{
"res_id":12,
"type":1,
"val":"121A"
}
]
}
Return example
{
"errno": 0,
"error":"succ",
"data":
{
"uuid":"42742677-adc3-54ca-83a1-5aaaf71482f8"
}
}