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.

Create a Channel

To create a new channel, send an HTTP POST to https://api.thingspeak.com/channels.

Valid parameters:

  • api_key (string) - User’s API key. This is different from a channel API key, and can be found in your profile page. (required).

  • description (string) - Description of the channel (optional)

  • elevation (integer) - Elevation in meters (optional)

  • field1 (string) - Field 1 name (optional)

  • field2 (string) - Field 2 name (optional)

  • field3 (string) - Field 3 name (optional)

  • field4 (string) - Field 4 name (optional)

  • field5 (string) - Field 5 name (optional)

  • field6 (string) - Field 6 name (optional)

  • field7 (string) - Field 7 name (optional)

  • field8 (string) - Field 8 name (optional)

  • latitude (decimal) - Latitude in degrees (optional)

  • longitude (decimal) - Longitude in degrees (optional)

  • metadata (text) - Metadata for the channel, which can include JSON, XML, or any other data (optional)

  • name (string) - Name of the channel (optional)

  • public_flag (true/false) - Whether the channel is public, default false (optional)

  • tags (string) - Comma-separated list of tags (optional)

  • url (string) - Webpage URL for the channel (optional)

JSON

To create a new channel, send an HTTP POST to https://api.thingspeak.com/channels.json.

Example POST:

POST https://api.thingspeak.com/channels.json
     api_key=XXXXXXXXXXXXXXXX
     name=My New Channel

The response is a JSON object of the new channel, for example:

{
  "id": 4,
  "name": "My New Channel",
  "description": null,
  "metadata": null,
  "latitude": null,
  "longitude": null,
  "created_at": "2014-03-25T13:12:50-04:00",
  "elevation": null,
  "last_entry_id": null,
  "ranking": 15,
  "username": "iothans",
  "tags": [],
  "api_keys":
  [
    {
      "api_key": "XXXXXXXXXXXXXXXX",
      "write_flag": true
    }
  ]
}

XML

To create a new channel, send an HTTP POST to https://api.thingspeak.com/channels.xml.

Example POST:

POST https://api.thingspeak.com/channels.xml
     api_key=XXXXXXXXXXXXXXXX
     name=My New Channel

The response is an XML object of the new channel, for example:

<?xml version="1.0" encoding="UTF-8"?>
<channel>
    <id type="integer">4</id>
    <name>My New Channel</name>
    <description nil="true" />
    <metadata nil="true" />
    <latitude type="decimal" nil="true" />
    <longitude type="decimal" nil="true" />
    <created-at type="dateTime">2014-03-25T20:17:44-04:00</created-at>
    <elevation nil="true" />
    <last-entry-id type="integer" nil="true" />
    <ranking type="integer">15</ranking>
    <username>iothans</username>
    <tags type="array" />
    <api-keys type="array">
        <api-key>
            <api-key>XXXXXXXXXXXXXXXX</api-key>
            <write-flag type="boolean">true</write-flag>
        </api-key>
    </api-keys>
</channel>

Related Topics

Was this topic helpful?