Execute the resource of an endpoint

Execute the resource of an endpoint describes the API structure for the executing the resources of an endpoint.

Table 1. Execute the resource of an endpoint
Title Execute the resource of an endpoint
URL http://<impact_url>/m2m/endpoints/{serialNumber}/{resourcePath}
Method POST
Content-Type application/json
URL Params

The following are the URL parameters:

  • serialNumber: [string]: Specifies the serial number of device for which resource is to be executed

  • resourcePath: Specifies the URI of the resource on which the client application wants to perform the execute operation. Depending on the nature of the request, it can consists of one or more of the following parameters in the defined syntax:

    • objectId: [string]: Specifies the unique identity of the object within the client.

    • objectInstanceId: [string]: Specifies the unique identity of the object instance of the object within the client.

    • resourceId: [string]: Specifies the unique identity of the resource within the object.

    • resourceInstanceId: [string]: Specifies the unique identity of the resource instance within the resource.

    The possible input syntax for resourcePath are:

    • ObectId
    • ObectId/InstanceId
    • ObectId/InstanceId/ResourceID
    • ObectId/InstanceId/ResourceID/ResourceInstanceID
    Note:

    If a resource path does not exist for the device, yet it is mentioned in the request, then IMPACT IoT does not validate the resource path and accepts the request. Final response to callback URL contains the result code and error message, if any.

  • needNotification: [Boolean]: The flag that indicates where a wake up trigger is required, to process the command.

    The default value is false. When set to false, the wake up trigger is not sent to the device.

Data Params

requestId:[string]: Specifies the request ID provided in case of valid and accepted request

msg:[string] : info/warning/error message

Success Code
Response Code: 202
Error Code
400 : Bad Request 
401 : Unauthorized 
403 : Forbidden 
404 : Not Found
Sample Call

1. Execute the resource of an endpoint with object ID.

Curl:
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json'  --header 'Authorization: Basic ZG9jdXNlcjpBc2RmMSM=' 'http://<impact_url>/m2m/endpoints/010920163/3'
Response Body:
{
  "requestId": "3968bd34-5df9-4008-a7cd-f2073b6e4257",
  "msg": "Accepted"
}

2. Execute the resources of an endpoint with object ID and instance ID.

Curl:
curl -X POST --header 'Accept: application/json'  --header 'Authorization: Basic ZG9jdXNlcjpBc2RmMSM=' 'http://<impact_url>/m2m/endpoints/010920163/3/0'
Response Body:
{
  "requestId": "daee6a34-20b7-4417-9319-507717e80de3",
  "msg": "Accepted"
}

3. Execute the resources of an endpoint with object ID, Instance ID, and resource ID.

Curl:
curl -X POST --header 'Accept: application/json'  --header 'Authorization: Basic ZG9jdXNlcjpBc2RmMSM=' 'http://<impact_url>/m2m/endpoints/010920163/3/0/5'
Response Body:
{
  "requestId": "46f09da9-46cb-4a7e-a3f7-5442a7609640",
  "msg": "Accepted"
}

4. Execute the resources of an endpoint with object ID, Instance ID, resource ID, and instance resource ID.

Curl:
curl -X POST --header 'Accept: application/json'  --header 'Authorization: Basic ZG9jdXNlcjpBc2RmMSM=' 'http://<impact_url>/m2m/endpoints/010920163/3/0/7/0'
Response Body:
{
  "requestId": "0b6fca71-1dbc-4a1c-97a2-4f5f37dbbc90",
  "msg": "Accepted"
}
Notes None