Main Content

Read Last Entry

Read last entry in channel with HTTP GET

Request

HTTP Method

GET

URL

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

URL Parameters

NameDescription

<channel_id>

(Required) Channel ID for the channel of interest.

<format>

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

Example: https://api.thingspeak.com/channels/266256/feeds/last.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

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 or false

location

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

true or false

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 Last Entry, and Provide Results 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. This example returns the last entry from channel 9 in JSON format.

https://api.thingspeak.com/channels/9/feeds/last.json

Read Last Entry including Location, and Provide Results in XML Format

When you include location=true, ThingSpeak returns the location information for the last entry. Entry location information is different from the channel location information, which is set on the Channel Settings tab. Append the first parameter after a question mark ?. This request returns the results in XML format.

https://api.thingspeak.com/channels/9/feeds/last.xml?location=true

Read Last Entry Including Status From a Private Channel, and Provide Results 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. Reading from a private channel requires the read API Key. Use the query string parameter api_key to specify the API Key. Each entry also has a status field. In this example, status=true returns the channel status entry for the last field along with the feed data. Append the second parameter after the ampersand &.

https://api.thingspeak.com/channels/9/feeds/last.csv?api_key=E52AWRAV1RSXQQJW&status=true

Response

Success

HTTP Status Code

200 OK

Body

 JSON or Text 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.