Asynchronous Control¶
The Invoke Asynchronous Multipoint Service executes the asynchronous multi-point control.
Request Format¶
PUT http://{apigw-address}/dataService/devices/multiInvoke?orgId={}
Request Parameters (URI)¶
Name |
Location (Path/Query) |
Required or not |
Data type |
Description |
---|---|---|---|---|
orgId |
Query |
Yes |
String |
Organization ID which the asset belongs to. How to get orgId>> |
Request Parameters (Body)¶
Name |
Required or not |
Data type |
Description |
---|---|---|---|
data |
True |
Object |
Request data object. See the table below for its structure |
Name |
Required or not |
Data type |
Description |
---|---|---|---|
requestId |
True |
String |
Request ID. |
orgId |
True |
String |
OU ID |
callType |
False |
String |
Its value must be ASYNC, which indicates asynchronous mode |
controlChannelId |
True |
String |
Created control channel ID. |
productKey |
True |
String |
Product key of the product that the measurement point belongs to, which is used to specify a device asset along with the |
deviceKey |
True |
String |
Device key of the product that the measurement point belongs to, which is used to specify a device asset along with the productKey |
assetId |
True |
String |
Asset ID of the device asset that the measurement point belongs to, which is used to specify a device asset |
serviceId |
True |
String |
Invoked service ID |
callbackUrl |
False |
String |
Callback function URL |
inputData |
False |
Object |
JSON object consisting of the key-value pairs of input value |
timeout |
False |
long |
Timetout in milliseconds. Its default value is 30000 and maximum value 300000. |
gmtServiceRequest |
False |
long |
Timestamp when the request is made. If it is not specified, the system timestamp will be used. |
Note
In the data
object, you may use either `assetId
or the combination of productKey
and deviceKey
to identify a device asset. If all the three parameters exist in the subscribePointList
, the assetId
will be used to identify the device.
Response Parameters¶
Name |
Data type |
Description |
---|---|---|
status |
Int |
Status code |
msg |
String |
Response message |
submsg |
String |
Response sub-message |
data |
Object |
Response data object, the structure of which is in the table below |
Name |
Data type |
Description |
---|---|---|
requestId |
String |
Service request ID |
messageId |
String |
Service message ID |
requestMethod |
String |
Service request method |
callType |
String |
Service request type, where |
controlChannelId |
String |
Control channel ID |
productKey |
String |
Product key of the product that the measurement point belongs to, which is used to specify a device asset along with the deviceKey |
deviceKey |
String |
Device key of the product that the measurement point belongs to, which is used to specify a device asset along with the productKey |
assetId |
String |
Asset ID of the device asset that the measurement point belongs to, which is used to specify a device asset |
serviceName |
String |
Service name |
serviceId |
String |
Service ID |
callbackUrl |
String |
Callback function URL |
inputData |
Object |
Object consisting of the key-value pairs of input data |
outputData |
Object |
Object consisting of the key-value pairs of output data |
status |
Int |
Control status, where 0 means success and other values mean failure |
msg |
String |
Response message |
submsg |
String |
Response sub-message |
timeout |
long |
Timeout |
gmtServiceRequest |
long |
Service request time |
gmtServiceReply |
long |
Service response time |
gmtDeviceReply |
long |
Device response time |
Note
In the subscribePointList object, the assetId is preferred to identify a device. If assetId does not exist, the combination of deviceKey and productKey will be used to identify a device.
Samples¶
Request Sample¶
PUT http://{apigw-address}/dataService/devices/multiInvoke?orgId=o15434988531231
{
"data":[
{
"requestId":"dfsadfdsafdsaf",
"orgId":null,
"callType":"ASYNC",
"controlChannelId":"DATASVC.CONTROL.afdasfasdf",
"productKey":"dfasdf",
"deviceKey":"dsfa",
"assetId":"aaa",
"serviceId":"bbb",
"callbackUrl":null,
"inputData":{
"arg":10
},
"timeout":30000,
"gmtServiceRequest":132132465464
},
{
"requestId":"erwerwradf",
"orgId":null,
"callType":"ASYNC",
"controlChannelId":"DATASVC.CONTROL.afdasfasdf",
"productKey":"dfasdf",
"deviceKey":"dsfa",
"assetId":"aaa",
"serviceId":"ccc",
"callbackUrl":null,
"inputData":{
"arg":10
},
"timeout":30000,
"gmtServiceRequest":132132465464
}
]
}
Response Sample¶
{
"status":0,
"msg":"Success",
"submsg":null,
"data":[
{
"requestId":"testRequestId1",
"messageId":null,
"requestMethod":"thing.service.d",
"callType":"ASYNC",
"controlChannelId":"DATASVC.CONTROL.controlChannelId1",
"productKey":"6Bt59ySj",
"deviceKey":"zBAofs6D4s",
"assetId":"YCdyvNmc",
"serviceName":"testService",
"serviceId":"d",
"callbackUrl":null,
"inputData":{
"testArg":1.0
},
"outputData":{
},
"status":1000,
"msg":"para error",
"submsg":"para error",
"timeout":30000,
"gmtServiceRequest":1536638267507,
"gmtServiceReply":1536638267509,
"gmtDeviceReply":-1
},
{
"requestId":"testRequestId2",
"messageId":null,
"requestMethod":"thing.service.d",
"callType":"ASYNC",
"controlChannelId":"DATASVC.CONTROL.controlChannelId1",
"productKey":"6Bt59ySj",
"deviceKey":"zBAofs6D4s",
"assetId":"YCdyvNmc",
"serviceName":"testService",
"serviceId":"d",
"callbackUrl":null,
"inputData":{
"testArg":1.0
},
"outputData":{
},
"status":1000,
"msg":"para error",
"submsg":"para error",
"timeout":30000,
"gmtServiceRequest":1536638267507,
"gmtServiceReply":1536638267509,
"gmtDeviceReply":-1
}
]
}