Documentation

Mistake on this page? Email us

Sending commands to resources

Device Management lets you send Constrained Application Protocol (CoAP) commands to devices. This lets you read, write, and execute resources and create new object instances on deployed devices.

Note: You must set up an event notification channel to receive the results of your command executions.

Reading resource values

You can retrieve values from a device's resources, resource instances and object instances.

In Portal: Reading resource values

To view an observable resource:

  1. Go to Device directory > Devices in Device Management Portal.

    The Device details pane opens to the right.

  2. Select the Resources tab.

    This tab lists the device's resources and indicates whether a resource is observable.

  3. Click the name of a resource.

    This opens an information window. For observable resources, the window displays the latest value.

Using the API: Reading resource values


Use the /v2/device-requests/{device-id} POST API to send a GET command to the device, to read the latest value from a device resource.

Writing resource values

You can use the Write operation to set the value of a resource, an array of resource instances or multiple resources from an object instance.

In Portal: Writing resource values

To write a resource value:

  1. Go to Device directory > Devices in Device Management Portal.

    The Device details pane opens to the right.

    This tab lists the device's resources and indicates whether a resource is observable.

  2. Click the name of a resource.

    This opens an information window.

  3. Click the Edit button.

  4. Click Put.

  5. Enter the new resource value in the Value field.

  6. Click Send.

Note: The device rejects attempts to write non-writable resource.

Using the API: Writing resource values


Use the /v2/device-requests/{device-id} POST API to send a PUT command to the device, to write a new value to a device resource.

Creating an object instance

You can create a new object instance under an existing object on the device.

For more information about the device data structure, see Device resource model.

In Portal: Creating an object instance

To create a new instance of an existing object:

  1. Go to Device directory > Devices in Device Management Portal.

    The Device details pane opens to the right.

    This tab lists the device's resources and indicates whether a resource is observable.

  2. Click the name of a resource.

    This opens an information window.

  3. Click the Edit button.

  4. Click Post.

  5. Enter content-type and payload-b64 values in the Value field. For more information, please see the documentation for /v2/device-requests/{device-id}.

  6. Click Send.

Using the API: Creating an object instance


Use the /v2/device-requests/{device-id} POST API to send a POST command to the device, to create a new instance of an existing object.

Executing an operation on a resource

Use the Execute operation to perform an action on an individual resource (there are no batch operations).

Tip: Device Management Client returns an error when it receives the Execute operation for object instances or resource instances.

In Portal: Executing an operation on a resource

To execute a resource:

  1. Go to Device directory > Devices in Device Management Portal.

    The Device details pane opens to the right.

    This tab lists the device's resources and indicates whether a resource is observable.

  2. Click the name of a resource.

    This opens an information window.

  3. Click the Edit button.

  4. Click Post.

  5. Enter the URI of the resource in the Value field; for example, /123/1/1.

  6. Click Send.

Using the API: Executing an operation on a resource


Use the /v2/device-requests/{device-id} POST API to send a POST command to the device, to execute an operation on a device resource.