Ways to Write Data
ThingSpeak™ channels store raw and processed data. You can upload data directly from devices using the REST API or the MQTT API. You can write data from third-party applications, including the Libelium Meshlium connector or The Things Network integration. You can also write directly from desktop MATLAB®.
Write Data with a Device
For connected devices that support HTTP commands such as GET, POST, and DELETE, you can send HTTP commands through the ThingSpeak REST API. These commands can come from a connected hardware device, such as an Arduino with a WiFi shield, or from software running on a desktop computer.
Write Data with REST API
REST Call | Description |
---|---|
Write Data | Write a single entry to one or more fields. |
Bulk Write JSON Data | Write many entries to a channel in JSON format with a single HTTP POST. |
Bulk Write CSV
Data | Write many entries to a channel in CSV format with a single HTTP POST. |
You can also write to your channel using MQTT, a lightweight device-messaging protocol. The ThingSpeak MQTT API writes to your channel using the Publish method. For more information, see Choose Between REST API and MQTT API.
Write Data with MQTT API
Publish Method | Description |
---|---|
Publish to a Channel Feed
Field | Publish a message to update a single channel field. |
Publish to a Channel Feed | Publish a message to update multiple channel fields simultaneously. |
Write Data with MATLAB
The ThingSpeak support toolbox lets you use MATLAB to analyze and visualize data
stored on ThingSpeak. Use thingSpeakWrite
to write scalar, vector, or
timetable data to multiple fields and multiple entries in your channels. For example, in
MATLAB, you can write the value 3.2 to channel 17504.
thingSpeakWrite(17504,3.2,'WriteKey','23ZLGOBBU9TWHG2H')
Write Data with Software
You can write directly to ThingSpeak in your software application using a communication library for HTTP or MQTT. You can use the REST API or MQTT API commands listed in the tables.
Write Data from the Web
You can import data to your channel with a CSV file. Click the Data Import / Export tab on your channel view. See Channel Data Import and Export for file format information.
Write Data with Meshlium
You can use the ThingSpeak Cloud Connector with Libelium's Meshlium IoT connector to automatically store your data. The Cloud Connector creates channels and maintains the channel list to keep your device data stored and ready for analysis. See Write Data with Libelium Meshlium System for detailed setup and troubleshooting information.
Write Data with The Things Network
You can use the ThingSpeak integration at The Things Network to automatically forward data to your ThingSpeak channel. See Write Data from The Things Network to learn how to add a ThingSpeak integration to an existing The Things Network application. See Collect Agricultural Data over The Things Network to learn how to set up long-range data collection using The Things Network.