ThingSpeak

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Publish to a Channel Feed

Publish message to update multiple channel fields simultaneously

Topic

channels/<channelID>/publish/<apikey>

Description

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 Configurations. To update multiple Payload Parameters simultaneously.

  • 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.

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.

field1

Data to be entered in the field 1 of a channel.

For example: field1=100

field2

Data to be entered in the field 2 of a channel.

For example: field2=100

field3

Data to be entered in the field 3 of a channel.

For example: field3=100

field4

Data to be entered in the field 4 of a channel.

For example: field4=100

field5

Data to be entered in the field 5 of a channel.

For example: field5=100

field6

Data to be entered in the field 6 of a channel.

For example: field6=100

field7

Data to be entered in the field 7 of a channel.

For example: field7=100

field8

Data to be entered in the field 8 of a channel.

For example: field8=100

lat

Location of your channel in the form of latitude.

For example: lat=10.45

long

Location of your channel in the form of longitude.

For example: long=35.4

elevation

Elevation of your channel from the ground level, in meters.

For example: elevation=100

status

Status message of your channel.

For example: status=Message

twitter

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

For example: twitter=nohans

tweet

Status message update of your Twitter account.

For example: tweet=Tweet from my channel

created_at

Date of feed entry in ISO 8601 format.

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

timezone

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

Examples

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.

Introduced in R2016b

Was this topic helpful?