Execute Resources

If a Device has an executable resource, then the IMPACT IoT may send an execute command JSON using the POST method to /devices. The resources token contains an array of URIs to perform execute on and the endPointClientNames token contains an array of Device identifiers on which the operation is executed. The Adaptation Layer must respond with http status 200 OK and asynchronously POST command response to /m2m/device.

If any one of the Devices fails to perform the execute operation, then the entire operation is considered a failure and appropriate status codes from the enumeration can be sent. If correlatorId is found in the execute command then the same token along with its value must be sent back in the response.

Table 1. Execute resources API format
Parameters Description
URL http://<adapter_hostname>:<port>/devices
Method POST
Content-Type application/json
Parameters

The parameters are:

  • correlatorId - Specifies a unique identification generated by IMPACT IoT to identify the command.
  • endPointClientNames - Specifies an array of Device serial numbers.
  • resources - Specifies an array of Device resources on which Execute operation is to be performed.
Sample Call
{
	“correlatorId”:”the correlator value”
               "execute":[
                           {
                                 "resources":"device/0/battery",
                                 "endPointClientNames":["TTo1AZliuT"]
                           },
                           {
                                 "resources":"device/0/firmware",
                                 "endPointClientNames":["TTo1AZliuT","asdfgh"]
                           }
                ]
}

Response Body:

{
	“correlatorId”:”the correlator value”
                "executeResponse":{
		“requestStatus”:0,
		“responseCode”:0,
}
}
Success Code
Response Code: 200
Error Code
400 : Bad Request
401 : Unauthorized 
403 : Forbidden 
404 : Not Found