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:
- Create an action for READ request.
- Enter the action name.
- Select the primitive Impact.DeviceFanout.
- Enter the resource device/0/battery with the value=30, Operation = READ.
{"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
{"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
Topic = ds/8800002400000/request Payload = {"type":"read","correlatorid":”MDM_24_2”,"resourcepath": “sensor/0/configuration” }
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.