{"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
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 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 Live Demo<\/a><\/p>\n [cce]http:\/\/api.thingspeak.com\/channels\/9\/field\/1\/last.txt?prepend=Your%20light%20level%20is%20&append=.%20Is%20someone%20in%20your%20room?[\/cce]<\/p>\n Check out the ThingSpeak Documentation<\/a> for more information.<\/p>\n","protected":false},"excerpt":{"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.Modifying\u00a0the response<\/strong><\/h3>\n
\n
\nLast.txt
\nLet’s say you… read more >><\/a><\/p>\n","protected":false},"author":148,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[30,62,61],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/posts\/545"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/users\/148"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/comments?post=545"}],"version-history":[{"count":13,"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/posts\/545\/revisions"}],"predecessor-version":[{"id":2124,"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/posts\/545\/revisions\/2124"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/media?parent=545"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/categories?post=545"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/tags?post=545"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}