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.

Create Channel

Create a new channel with HTTP POST

Request

HTTP Method

POST

URL

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

URL Parameters

NameDescription

<format>

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

Example:https://api.thingspeak.com/channels.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) Specify an ID or name for the client making the request.

<string>

field1

(Optional) Field 1 name.

<string>

fieldX

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

<string>

latitude

(Optional) Latitude in degrees.

<decimal>

longitude

(Optional) Longitude in degrees.

<decimal>

metadata

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

<string>

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.<tags>
url(Optional) Web page 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

collapse all

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

Create a channel titled "My Channel" with three named fields: "Stuff", "Things", and "Data". Make the channel shared with everyone by setting the public_flag to true. Here is the format of the request.

POST https://api.thingspeak.com/channels.json
    api_key=XXXXXXXXXXXXXXXX
    name=My Channel
    public_flag=true
    field1=Stuff
    field=Things
    field3=Data

  1. In POSTMAN, select POST from the drop-down list of HTTP verbs, and enter https://api.thingspeak.com/channels.json in the address bar.

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

  3. Enter the additional parameters and values:

    • public_flag, Value: true

    • field1, Value: Stuff

    • field2, Value: Things

    • field3, Value: Data

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

The new channel is now available on your channels page.

Was this topic helpful?