Downlink Read Command

Last modified: Jun 6, 2019 @ 13:15

The “Read” command implies that the application is querying for some payload from the device. This command expects two responses from the device.

Sample request on the device

{
"token”: "7dc53df5-703e-49b3-8670-b1c468f47f1f",
"op”: "READ",
"ct”: "application/senml+json",
"payload”: [{"n":"/3303/0/5701"}]
}

Sample response from the device

{
"token”: "7dc53df5-703e-49b3-8670-b1c468f47f1f",
"op”: "READ",
"ct”: "application/senml+json",
"payload”: [{"n":"/3303/0/5701"}]
}

The device should reply with the same token as received through the command’s payload.

  • code can be anything as per HTTP response codes. Messages containing other codes will be silently discarded.
  • token” can be between 8 and 36 characters long and will contain [a-z] [A-Z] [0-9] and “-“.
  • op” is the type of the operation to be performed. For example, READ.
  • ct” is the content type of the MQTT payload.
  • payload” contains the SenMl that has the link of the IPSO resource upon which the read operation should be performed by the device.

DDM GUI initiated Read

  • Navigate to a readable device Resource.
  • Click Read of the corresponding resource to initiate a Read request for the resource.

  • The sample response received for ‘Sensor Units‘ read operation is shown below. To see the log, navigate to the resource page.

  • A second response with the actual Read payload on the ingest topics, in case where the operation is successful. All conditions/rules for the payload-ingest is applicable.  On the DDM device page, the reading is visible with the timestamp against the resource.

Send Read command to a device using API

{id}/read
Title Read
URL swagger/ui/index#!/Resource/Resource_ReadResource
Method GET
Parameters 1.     Id

2.     X-DeviceNetwork

Note: ‘ID’ is the Resource ID. Fetch the resource ID of a readable resource from DDM as described earlier. ‘X-DeviceNetwork’ is the Device Network ID. Fetch the ‘device_network_id’ as described earlier.

Response Messages
HTTP Status Code Reason
204 No Content
400 Resource is not readable
401 Unauthorized
404 Resource not found
  • After fetching the resource list, navigate to Resource ->GET/api/v3/resources/{id}/read.

  • Fill the required fields as described in the table and click Try it out!.

  • After successful transaction, the sample response received for ‘Sensor Units‘ read operation is shown below. To see the log, navigate to the resource page.

  • A second response with the actual Read payload on the ingest topics, in case where the operation is successful. All conditions/rules for the payload-ingest is applicable.  On the DDM device page, the reading is visible with the timestamp against the resource.