Reading data without using token

To support READ commands, devices must listen or SUBSCRIBE to the following topic.

ds/$serialNumber}/request

Where $serialNumber is the identifier of the device.

  • To do READ from API call:
    http:///m2m/endpoints//
    http://clab962node02/m2m/endpoints/1201201002/device/0/battery
  • To do READ from CDP UI:
    1. Create an action for READ request.
    2. Enter the action name.
    3. Select the primitive Impact.DeviceFanout.
    4. Enter the resource device/0/battery with the value=30, Operation = READ.
The topic will include the following formatted value:
{"type":"read","correlatorid":$correlatorid,"resourcepath":  $resourcepath}

Where,

$correlatorid, is a string created by IMPACT IoT that is used to link this request to the response.

$resourcepath, is the path name of the resource.

The resource path is used by the Device to identify the data element to be read and should conform to the /object/objectInstance/resource/resourceInstanceId URI format as used when collecting data.

So that confirmation of the read request is achieved, once the PUBLISH has been received in the device, the device must PUBLISH a response in the following format, with topic:

us/$Serialnumber/response
The payload will have the following format:
{"type":"read","correlatorid":$correlatorid,"resourcepath":$resourcepath,"value":$value,"status":$status,"reason":$reason}

Where:

$correlatorid, is a string received from IMPACT IoT in the request that is used to link this request to the response.

$resourcepath, is the path name of the resource.

$value, is the value of the read resource.

$status, is the result of the action. HTTP Status codes apply, “200” means a successful read.

$reason is the reason sent by the device when a problem arises.

For example:

The device sends a SUBSCRIBE for configuration changes.

Topic = ds/8800002400000/request
The server sends the following to read a resource to the device in a PUBLISH.
Topic = ds/8800002400000/request 
Payload = {"type":"read","correlatorid":”MDM_24_2”,"resourcepath":  “sensor/0/configuration” }
The read is successful, and the device sends the following PUBLISH to acknowledge this with the value.
Topic = us/8800002400000/response
{"type":"read","correlatorid":”MDM_24_2”,"resourcepath":  “sensor/0/configuration”,"value": 456, “status”:200 }

Within the device, care must be made to ensure that the device responds within a reasonable time, say 10 seconds. If this is not the case the IMPACT IoT server will time out.