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.

Read Data

Read data from all fields in a channel with HTTP GET

Request

HTTP Method

GET

URL

https://api.thingspeak.com/channels/<channel_id>/feeds.<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/feeds.json

Query String Parameters

NameDescriptionValue-Type
api_key

(Required for private channels). Specify Read API Key for this specific channel. The Read API Key is found on the API Keys tab of the channel view.

<string>

results

(Optional) Number of entries to retrieve. The maximum number is 8,000.

<integer>

days

(Optional) Number of 24-hour periods before now to include in feed. The default is 1.

<integer>

start

(Optional) Start date in format YYYY-MM-DD%20HH:NN:SS.

<datetime>

end

(Optional) End date in format YYYY-MM-DD%20HH:NN:SS.

<datetime>

timezone

(Optional) Identifier from Time Zones Reference for this request.

<string>

offset

(Optional) Timezone offset that results are displayed in. Use the timezone parameter for greater accuracy.

<integer>

status

(Optional) Include status updates in feed by setting "status=true".

<true/false>

metadata

(Optional) Include metadata for a channel by setting "metadata=true".

<true/false>

location

(Optional) Include latitude, longitude, and elevation in feed by setting "location=true".

<true/false>

min

(Optional) Minimum value to include in response.

<decimal>

max(Optional) Maximum value to include in response.

<decimal>

round

(Optional) Round to this many decimal places.

<integer>

timescale

(Optional) Get first value in this many minutes, valid values: 10, 15, 20, 30, 60, 240, 720, 1440, "daily".

<integer> or <string>

sum

(Optional) Get sum of this many minutes, valid values: 10, 15, 20, 30, 60, 240, 720, 1440, "daily".

<integer> or <string>

average

(Optional) Get average of this many minutes, valid values: 10, 15, 20, 30, 60, 240, 720, 1440, "daily".

<integer> or <string>

median

(Optional) Get median of this many minutes, valid values: 10, 15, 20, 30, 60, 240, 720, 1440, "daily".

<integer> or <string>

callback(Optional). Function name to be used for JSONP cross-domain requests.<string>

Examples

You can use your web browser to complete GET HTTP requests to the RESTful API for ThingSpeak™. To see the format for an HTTP response, click the link or copy it to your browser.

Read Three Entries in JSON Format

Channel 9 contains information from several home environment sensors. You can read data from this public channel. The format for the response occurs at the end of the URL, before any query string parameters. Append the first parameter after a question mark ?. You can use the results parameter to control the number of entries returned, which is up to 8000.

https://api.thingspeak.com/channels/9/feeds.json?results=3

Read Four Entries in XML Format

In this example, the format is specified as XML. The results parameter is used to return a set number of entries, in this case four. The first parameter is appended after a question mark ?.

http://api.thingspeak.com/channels/9/feeds.xml?results=4

Read Five Entries From a Private Channel in JSON Format

To read data from a private channel, supply the Read API Key with the parameter api_key. Append the first parameter after a question mark ?. Append the second parameter after an ampersand &. In this case, results is used to request five results.

https://api.thingspeak.com/channels/9/feeds.json?api_key=E52AWRAV1RSXQQJW&results=5

Read a Data Range of Events in CSV Format

When you request the output in csv format, the file returned is a comma-separated variable format. Depending on your computer configuration, your browser can start additional software to display this format. In this example, the start and end parameters are used to specify date limits for the requested data.

http://api.thingspeak.com/channels/9/feeds.csv?start=2011-11-11%2010:10:10&amp;end=2011-11-11%2011:11:11

Response

Success

HTTP Status Code

200 OK

Body

 JSON Example

 XML Example

 CSV Example

Error

For the full list, see Error Codes.

If you do not have access to the channel, the response is -1.

Was this topic helpful?