Call this operation to publish a broadcast message to all the devices that subscribe to a specified topic.

Limits

A server SDK can send only one broadcast message to IoT Platform per second. A message in IoT Platform can be subscribed by multiple devices.

Request parameters

Parameter Type Required Description
Action String Yes The operation that you want to perform. Set the value to PubBroadcast.
ProductKey String Yes The key of the product that broadcast messages.
TopicFullName String Yes

The full name of the topic that receives broadcast messages. The format is: /broadcast/${productKey}/your custom field. ${productKey} is the product key of the devices that receive broadcast messages.

Note
  • When you develop your device SDK, define topics for broadcast. Topics for broadcast are not created in the IoT Platform console.

  • Up to 1,000 devices can subscribe to a broadcast topic.

    If the number of devices that will subscribe to a broadcast topic exceeds the maximum limit, you can group the devices. For example, if you have 5,000 devices, divide them into five groups each containing 1,000 devices. You can define the custom fields of the topics to group1, group2, group3, group4, and group5, and subscribe each group of devices to a broadcast topic respectively. You call this operation five times to publish a message to all the 5,000 devices.

MessageContent String Yes The body of the message to be published. Convert the original message content into binary data and encode the data using Base64 encoding to generate the message body.
Common request parameters - Yes See Common parameters.

Response parameters

Parameter Type Description
RequestId String The globally unique ID generated by Alibaba Cloud for the request.
Success Boolean Indicates whether the call is successful. A value of true indicates that the call is successful. A value of false indicates that the call has failed.
ErrorMessage String The error message returned when the call fails.
MessageId String The message ID generated by IoT Platform when the message is sent.
Code String The error code returned when the call fails. For more information on error codes, see Error codes.

Examples

Request example

https://iot.cn-shanghai.aliyuncs.com/?Action=PubBroadcast
&ProductKey=al**********
&TopicFullName=%252Fbroadcast%252FUPqSxj2vXXX%252Fxxx
&MessageContent=aGVsbG93b3JsZA==
&Common request parameters

Response example

  • JSON format

    {
          "RequestId":"BB71E443-4447-4024-A000-EDE09922891E",
          "Success":true,
      }
  • XML format

    <? xml version='1.0' encoding='UTF-8'? >
      <PubBroadcastResponse>
          <RequestId>BB71E443-4447-4024-A000-EDE09922891E</RequestId>
          <Success>true</Success>
      </PubBroadcastResponse>