Skip to main content
Skip table of contents

Subscribing and unsubscribing devices to a topic

Request

To subscribe one or more devices to a topic, send a PUT request to:

BASH
http://<host>:<port>/mib/v2/topics/{topicId}/manageDevices

Client applications running on WebOS and Tizen Smart TVs must also subscribe to the topic in AWS IoT Core. See the AWS IoT Core documentation for details.

Headers

  • Content-Type: application/json

Mandatory fields

  • topicId (in URL) – the ID of the topic

Other fields

  • removeAllDevices – if true, all existing devices are removed from the topic.

  • addDevices – a list of devices to be added. This contains a list of device IDs.

  • removeDevices – a list of devices to be removed. This contains a list of device IDs.

If you specify both removeAllDevices and addDevices, all existing devices will be unsubscribed from the topic and the devices specified in the addDevices block will be subscribed to it.

Example

A request with this payload subscribes the two specified devices to the topic specified in the URL and unsubscribes the one specified device from it:

CODE
{
  "addDevices": [
    {
      "deviceId": "59bb5fbbc6f9d5000801ae28"
    },
    {
      "deviceId": "59bb5fbbc6f9d5000801ae29"
    }
  ],
  "removeDevices": [
    {
      "deviceId": "59bb5fbbc6f9d5000801ae30"
    }
  ]
}

The devices must already be registered with DMM.

Response

A successful request returns an HTTP 200 status.

An unsuccessful request returns an HTTP 400 status if the topic cannot be found in DMM.

An unsuccessful request returns an HTTP 404 status is the topic is not provisioned in DMM.

See also

For full details of this API, see the Device Messaging Manager (DMM) API documentation v2.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.