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.

Write Data to Channel

Use the REST and MQTT APIs to update channels with software or devices

ThingSpeak™ is an IoT platform that uses channels to store data sent from apps or devices. You can write data to your ThingSpeak channels in several ways: HTTP calls from the REST API, MQTT Publish method, and the thingSpeakWrite function from MATLAB. Learn more about how to Choose Between REST API and MQTT API to update a channel.

REST API

expand all

Write DataUpdate channel data with HTTP GET or POST
Bulk Write JSON DataWrite many entries to a channel in JSON format with a single HTTP POST
Bulk Write CSV DataWrite many entries to a channel in CSV format with a single HTTP POST.

MQTT API

expand all

Publish to a Channel FeedPublish message to update multiple channel fields simultaneously
Publish to a Channel Field FeedPublish message to update single channel field

Functions

expand all

thingSpeakWriteWrite data to a ThingSpeak channel

Topics

Choose How to Write Data

Ways to Collect Data into a Channel

Collect data in your channel with hardware or software on devices or computers using the REST API, MQTT, or MATLAB®.

Choose Between REST API and MQTT API

Learn when to use REST and MQTT to update a channel.

Write Data With Libelium Hardware

Write Data with Libelium Meshlium System

Use the ThingSpeak Cloud Connector with Libelium Meshlium hardware to easily store and analyze your data.

Write Data With Arduino and Particle Photon

Prototyping with Sonar Proximity Sensor

This example shows how to prototype with ThingSpeak™ using a Wi-Fi connected Arduino® board.

Publish to a Channel Using an Arduino Client

This example shows how to use an Arduino® MKR1000 board to record data in ThingSpeak™.

Bulk-Update Using an Arduino or an ESP8266

This example shows how to use either an Arduino® MKR1000 board or an ESP8266 board connected to a Wi-Fi® network to continuously collect Wi-Fi signal strength and bulk-update a ThingSpeak™ channel.

Bulk-Update a ThingSpeak Channel Using a Particle Photon Board

This example shows how to use a Particle Photon board connected to a Wi-Fi® network to bulk-update a ThingSpeak™ channel.

Publish to a Channel Using an Arduino Client

This example shows how to use an Arduino® MKR1000 board to record data in ThingSpeak™.

Publish Using Particle Photon Client

This example shows how to publish measured values to a ThingSpeak channel.

Write Data With ESP8266

Moisture Sensor using HTTP POST Requests to Channel

This example shows how to post multiple fields of data to a ThingSpeak™ channel from a device that wakes from deep sleep.

Post Temperature Data and Read from Channel

This example shows how to collect environmental data from a device and post it from your device to a ThingSpeak™ channel.

Remote Sensor Control Using MQTT Publish and Subscribe

This example demonstrates how to use the MQTT publish - subscribe architecture in ThingSpeak™.

Write Data With ESP32

Wireless Network Signal Strength with ESP32 with Arduino IDE

This example shows how to use the wireless network functionality of ESP32 to post data to ThingSpeak™.

Write Data With Raspberry Pi

Bulk-Update Using a Raspberry Pi Board

This example shows how to use a Raspberry Pi™ board that runs Python® 2.7 that is connected to a Wi-Fi® network to collect data.

Publish Using WebSockets in Python on a Raspberry Pi

This example shows how to use WebSockets on port 80 to publish to a ThingSpeak™ channel using a Raspberry Pi™ board that runs Python®.

Troubleshooting

Error Codes

See the details of ThingSpeak REST API error messages and corresponding HTTP status codes.

Troubleshoot MQTT Publish

Get help to resolve common mistakes when using MQTT publish.

Featured Examples