Downlink Write Command

Last modified: Jun 6, 2019 @ 09:20

The “Write” command implies that the application is writing payload to the device. This command expects only one response from the device.

Sample request on the device

{

"token”: "7dc53df5-703e-49b3-8670-b1c468f47f1f",

"op”: "WRITE",

"ct”: "application/senml+json",

"payload”: [{"n": "/3342/0/5852", "v": 1.0}]

}

Sample response from the device

{

"token”: "7dc53df5-703e-49b3-8670-b1c468f47f1f",

"code”: "201"

}

The type of the payload field of the write command contains a SenML. The value of “n” field of the SenML contains the IPSO resource link and the next field contains the value to be written. Based on the type of the value, the key is defined. For example, v denotes Integer, Float, and Double value, vs denotes the string value and vb denotes the Boolean value.

  • op” is the type of the operation to be performed. Ex. WRITE.
  • ct” is the type of the content type of the MQTT payload.

DDM GUI initiated Write

  • Navigate to a writeable device Resource.
  • Click Write of the corresponding resource to initiate a Write request for the resource.

  • In the resource page, provide a valid value and click “Write Value”.

  • The sample response received for ‘Application Type‘ write operation is shown below. To see the log, navigate to the resource page.

Send Write command to device using API

{id}/write
Title Write
URL swagger/ui/index#!/Resource/Resource_Write
Method PUT
Data Parameters 1.     Id

2.     WriteRequest

Parameter content type: application/json

writeRequest

{

"Id": "string",

"Value": "string",

"SendRequestSynchronously": true

}

3.     X-DeviceNetwork

Note: ‘ID’ is the Resource ID. Fetch the resource ID of a writeable resource from DDM as described earlier. ‘X-DeviceNetwork’ is the Device Network ID. Fetch the device network id as described earlier. WriteRequest is a type of application/json. ID is same as the Resource ID. Value is the write value of the resource.

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/resource/{id}/write.

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

  • After successful transaction, the sample response received for ‘Application Type‘ write operation is shown below. To see the log, navigate to the resource page.