Creating a topic and subscribing devices to it
Request
You are recommended to use the v2 endpoints to create a topic and then subscribe devices to it instead of using the method described on this page.
See:
To create a new topic without subscribing any devices to it, send a PUT request to:
http://<host>:<port>/mib/v1/topics/{topicName}/devices
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
topicName(in both URL and payload) – the name of the topicdevices– the devices to subscribe to the topic. Each device must include:deviceId– the unique ID of the device, as returned by ADMsubscriptionStatus– set totrueto subscribe the device to the topic.
Other fields
description– a description for the topicactive– set totrueto make the topic active (trueis the default)managedBy– the service that manages the topic. Must be one ofFCM,APNS,SNS, orIOT.modifiedBy– the entity/service that created/modified the topic
The values of the following fields are set by DMM. You should not set them yourself:
_id– the topic IDtopicARN– the topic’s Amazon Resource Name (ARN)devices.subscriptionARN– the device’s Amazon Resource Name (ARN)creationDate– the topic creation datemodifiedDate– the date the topic was modifieddeviceCount– the number of devices subscribed to the topic
Example
A request with this payload creates a topic and subscribes the specified devices to it:
{
"topicName": "New-Videos",
"active": true,
"devices": [
{
"deviceId": "5ca5e0ced2f2ff000118e9db",
"subscriptionStatus": true
},
{
"deviceId": "5cb0558b759587000105750a",
"subscriptionStatus": true
}
]
}
Response
A successful request returns an HTTP 200 status.
An unsuccessful request returns an HTTP 404 status if the topic does not exist.
See also
For full details of this API, see the Device Messaging Manager (DMM) API documentation v1.