{"id":545,"date":"2011-04-13T01:08:03","date_gmt":"2011-04-13T06:08:03","guid":{"rendered":"https:\/\/blogs.mathworks.com\/iot\/?p=545"},"modified":"2017-05-22T13:24:14","modified_gmt":"2017-05-22T17:24:14","slug":"hidden-api-commands","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/iot\/2011\/04\/13\/hidden-api-commands\/","title":{"rendered":"Hidden API Commands"},"content":{"rendered":"

When you are retrieving data from a ThingSpeak channel you have many options and formats to choose from. We wanted to highlight a few options that are easily overlooked.<\/p>\n

Last.txt<\/h3>\n

Let’s say you have an Arduino and you want to get the last value in a channel. You could get your feed and then write some parsing code to extract the data that you are looking for. It’s a waste of code space and also fills your finite buffers on your microcontroller. Let the cloud do the work and give you just the value you are looking for.<\/p>\n

Here’s how you would get our light levels: Live Demo<\/a><\/p>\n

[cce]http:\/\/api.thingspeak.com\/channels\/9\/field\/1\/last.txt[\/cce]<\/p>\n

Modifying\u00a0the response<\/strong><\/h3>\n

You can even add data to the response. Maybe you have Twilio<\/a> reading back your temperature. It would not be much fun if Twillio says to you, “80”. Sensor data without context is noise!<\/p>\n

Here are two optional parameters when returning the last data on a ThingSpeak Channel:<\/p>\n