This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Publish to a Channel Feed

Publish message to update multiple channel fields simultaneously




channels/<channelID>/publish/<apikey> publishes messages to the topic to update a channel feed. Replace <channelID> with the channel ID and <apikey> with the Write API Key of the channel. To learn more about configuring your channel, see Channel Properties. To update multiple parameters simultanously, see Payload Parameters.

  • Payload Parameters

  • Set the PUBLISH messages to have a QoS value of 0.

  • Set the connection RETAIN flag to 0.

  • Set the connection CleanSession flag to 1.

To learn more about these flags, see MQTT v3.1.1 specification.

Input Arguments

expand all

Channel ID for the publish target, specified as a numeric.

Data Types: uint16 | int16 | int8 | uint8

Channel write API Key. The value can be found on Channel Settings > API Keys. This value is different than the MQTT API Key used for connection, and it is different than the channel Read API Key

Data Types: char

Payload Parameters

Specify the optional payload parameters for the PUBLISH message as Name=Value arguments, separated using & as a string. For example: field1=100&field2=50&lat=30.61&long=40.35.


Data to be entered in field 1 of a channel.

For example: field1=100


Data to be entered in field x of a channel. Make sure the field is enabled in the channel settings.

For example: fieldx=100

X must be less than or equal 8, the number of allowed fields.


Location of your channel in the form of latitude.

For example: lat=10.45


Location of your channel in the form of longitude.

For example: long=35.4


Elevation of your channel from the ground level in meters.

For example: elevation=100


Status message of your channel.

For example: status=Message


User name of your Twitter® account that is linked to ThingTweet app.

For example: twitter=nohans


Status message update of your Twitter account.

For example: tweet=Tweet from my channel


Date of feed entry in ISO 8601 format.

For example: created_at=2014-12-31 23:59:59


Time zone of your channel data, specified as an identifier of the form as shown in Time Zones Reference.

For example: timezone=America/New_York


Configure MQTT.fx to send a PUBLISH message to update a channel feed.

Replace <channelID> with the channel ID and <apikey> with the Write API Key of the channel. This PUBLISH message publishes a value of 45 to field1 and 60 to field2 of the specified channel, along with a status message MQTTPUBLISH.