Documentation

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 Settings

Update channel settings with HTTP PUT

Request

Description

Use this request to write channel settings. Channel settings include channel description, field names, channel location, metadata, public or private status, and the name of the channel.

HTTP Method

PUT

URL

https://api.thingspeak.com/channels/<channel_id>.<format>

URL Parameters

NameDescription

<channel_id>

(Required) Channel ID for the channel of interest.

<format>

(Required) Format for the HTTP response, specified as json or xml.

Example:https://api.thingspeak.com/channels/266256.json

Body Parameters

NameDescriptionValue-Type
api_key(Required) Specify User API Key, which you can find in your profile. This key is different from the channel API keys.<string>
description(Optional) Description of the channel.<string>
field1

(Optional) Field 1 data.

<string>
field<X>

(Optional) Field X data, where X is the field ID.

<string>
latitude

(Optional) Latitude in degrees.

<decimal>
longitude

(Optional) Longitude in degrees.

<decimal>
elevation

(Optional) Elevation in meters.

<integer>
metadata

(Optional) Metadata for the channel, which can include JSON, XML, or any other data.

<text>
name

(Optional) Name of the channel.

<string>
public_flag

(Optional) Whether the channel is public. The default is false.

<true/false>
tags

(Optional) Comma-separated list of tags.

<string>
url

(Optional) Webpage URL for the channel.

<string>

Content-Type

application/x-www-form-urlencoded

Response

Success

HTTP Status Code

200 OK

Body

 JSON Example

 XML Example

Error

For the full list, see Error Codes.

Examples

Use POSTMAN to Write Channel Settings

You can use POSTMAN to try out your HTTP requests using the RESTful API for ThingSpeak. This example shows how to write new channel settings using POSTMAN.

Using an existing channel, change the channel name to Updated Channel and the field 1 title to Heart Rate. Also change the sharing to Public.

PUT https://api.thingspeak.com/channels/CHANNEL_ID
    api_key=XXXXXXXXXXXXXXXX
    name=Updated Channel
    public_flag=true
    field1=Heart Rate

  1. In POSTMAN, select PUT from the drop-down list of HTTP verbs and enter api.thingspeak.com/channels/<CHANNEL_ID>.json in the address bar, replacing <CHANNEL_ID> with the channel of interest.

  2. Enter the parameter api_key in the value column, enter your User API Key, which is found in Account > My Profile.

  3. Enter additional parameters and values:

    • name, Value: Updated Channel

    • field1, Value: Heart Rate

    • public_flag, Value: True

The response is in JSON format. Note the server response value of 200 OK, indicating successful writing of new channel settings.

The new channel settings are now available on your channels page.

Additional Material