Write on the resource of a gateway

Write on the resource of a gateway reflects the API structure for the writing on the resource of a gateway.

Table 1. Write on the resource of a gateway
Title Write on the resource of a gateway
URL http://<impact_url>/m2m/gateway/{$serialNumber}/{$resourcePath}
Method PUT
Content-Type application/json
URL Params

The following are the URL parameters:

  • resourceValue: [string]: Specifies the new value of the resource to overwrite. It can be a JSON structure or plain text or any other format depending on the protocol supported by the device and the definition of the resource to write.

    Example:
    {"resourceValue":”value”}
  • serialNumber: [string]: Specifies the serial number of device for which resource is to be deleted.

  • resourcePath: Specifies the URI of the resource on which the client application wants to perform the write 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 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. Write on the resource of a gateway with object ID.

Curl:
curl -X PUT --header 'Content-Type: application/json' --header 'Accept: application/json'  --header 'Authorization: Basic ZG9jdXNlcjpBc2RmMSM=' -d '{"resourceValue":"1"}' 'http://mfuat.mformation.com:9002/m2m/gateway/010920163/1'
Response Body:
{
  "requestId": "d2f4b23e-20e3-4df8-98cd-a65208fd4742",
  "msg": "Accepted"
}

2. Write on the resource of a gateway with object ID and instance ID.

Curl:
curl -X PUT --header 'Content-Type: application/json' --header 'Accept:
          application/json'  --header 'Authorization: Basic
        ZG9jdXNlcjpBc2RmMSM=' -d '{"resourceValue":"8"}'
        'http://mfuat.mformation.com:9002/m2m/gateway/010920163/0/3'
Response Body:
{
  "requestId": "c2a4b23e-20e3-4df8-98cd-a65708ed4742",
  "msg": "Accepted"
}

3. Write on the resource of a gateway with object ID, Instance ID, and resource ID.

Curl:
curl -X PUT --header 'Content-Type: application/json' --header 'Accept: application/json'  --header 'Authorization: Basic ZG9jdXNlcjpBc2RmMSM=' -d '{"resourceValue":"30"}' 'http://mfuat.mformation.com:9002/m2m/gateway/010920163/1/1/2'
Response Body:
{
  "requestId": "e0353f40-35c8-4853-a0da-4a4e2b0bd8fb",
  "msg": "Accepted"
}

4. Write on the resource of a gateway with object ID, instance ID, resource ID, and resource Instance ID.

Curl:
curl -X PUT --header 'Content-Type: application/json' --header 'Accept: application/json'  --header 'Authorization: Basic ZG9jdXNlcjpBc2RmMSM=' -d '{"resourceValue":"10000"}' 'http://mfuat.mformation.com:9002/m2m/gateway/010920163/3/0/7/0'
Response Body:
{
  "requestId": "27495a1d-78ce-4394-bc14-60f287668f77",
  "msg": "Accepted"
}
Notes

None