API - Documentation
Read Data
Read data from all fields in channel with HTTP GET
Request
HTTP Method
GET
URL
https://api.thingspeak.com/channels/1663924/feeds.[format]
URL Parameters
Name | Description |
---|---|
[format] | (Required) Format for the HTTP response, specified as json, xml, or csv. |
Example: https://api.thingspeak.com/channels/1663924/feeds.json
Query String Parameters
Name | Description | Value Type |
---|---|---|
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 response. The default is 1. | integer |
minutes | (Optional) Number of 60-second periods before now to include in response. The default is 1440. | 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 |
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 |
Note
The results parameter has the highest precedence. Using results with the parameters min, max, timescale, sum, average, or median can cause less than 8000 records to be returned. The results parameter determines the maximum number of entries to be used for a query, up to 8000. For example, consider a channel with one update per minute. A read request to that channel with the parameters ?results=120&sum=60 returns only two records, and not 120.
See the example "Read Two Hours of Entries in JSON Format and Average."
Response
Success
HTTP Status Code - 200 OK
Body
JSON Example
Request
GET https://api.thingspeak.com/channels/1663924/feeds.json?results=2 or GET https://api.thingspeak.com/channels/1663924/feeds?results=2
Response
{
"channel":
{
"id": 1663924,
"name": "Plovdiv Radiation Level",
"description": "Radiation Level in Plovdiv/Bulgaria",
"latitude": "0.0",
"longitude": "0.0",
"field1": "CPS", //Counter Per Second
"field2": "CPM", //Counter Per Minute
"field3": "μSv/h", //μSv Per Hour
"field4": "Algorithm", //Showing the used Algorithm to calculate μSv/h - SLOW for < 5.7 µSv/h, FAST for > 5.7 µSv/h, INST for > 88 µSv/h
"created_at": "2022-02-27T18:39:51Z",
"updated_at": "2022-02-27T21:26:59Z",
"last_entry_id": 12884
},
"feeds":
[
{
"created_at": "2022-03-08T18:32:15Z",
"entry_id": 12883,
"field1": "0", //Counter Per Second
"field2": "24", //Counter Per Minute
"field3": "0.13", //μSv Per Hour
"field4": "SLOW" //Showing the used Algorithm to calculate μSv/h - SLOW for < 5.7 µSv/h, FAST for > 5.7 µSv/h, INST for > 88 µSv/h
},
{
"created_at": "2022-03-08T18:33:15Z",
"entry_id": 12884,
"field1": "0", //Counter Per Second
"field2": "24", //Counter Per Minute
"field3": "0.13", //μSv Per Hour
"field4": "SLOW" //Showing the used Algorithm to calculate μSv/h - SLOW for < 5.7 µSv/h, FAST for > 5.7 µSv/h, INST for > 88 µSv/h
}
]
}
Note
"field1": "CPS", //Counter Per Second
"field2": "CPM", //Counter Per Minute
"field3": "μSv/h", //μSv Per Hour
"field4": "Algorithm", //Showing the used Algorithm to calculate μSv/h - SLOW for < 5.7 µSv/h, FAST for > 5.7 µSv/h, INST for > 88 µSv/h
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 1663924 contains information about Radiation Level. 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/1663924/feeds.json?results=3
Read Two Hours of Entries in JSON Format and Average
Channel 1663924 contains information about Radiation Level, updates once per minute. 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, up to 8000. In this request, 120 results are averaged into two responses.
https://api.thingspeak.com/channels/1663924/feeds.json?results=120&average=60
Read a Median Value of specific Date Range of Entries in JSON Format
Channel 1663924 contains information about Radiation Level. 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, up to 8000. In this example, the start and end parameters are used to specify date limits for the requested data. Median parameter are set to "daily". The result are median value of the radiation per day in that specific date slot.
Additional information
This project uses ThingSpeak to store the data. You can find more information regarding the ThingSpeak API on the ThingSpeak Help Center.