0

API v2 .../data/last not working?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

API v2 .../data/last not working?

by thayes on Thu May 03, 2018 9:44 am

The API says use this to fetch all data:
https://io.adafruit.com/api/v2/{username}/feeds/{feed_key}/data

And this to fetch the most recent entry:
https://io.adafruit.com/api/v2/{username}/feeds/{feed_key}/data/last

The first one work for me, and I get a big array of values. The second one results in this error:
{"error":"not found - API documentation can be found at https://io.adafruit.com/api/docs"}

Since the only difference between the two calls is appending "/last" to the URL I'm pretty sure that it isn't a bug in my code, an authentication problem (its a public feed also), etc.

What's going on? Is this a bug? Is the API documentation incorrect? Am I misunderstanding something?

thayes
 
Posts: 15
Joined: Mon Apr 04, 2016 5:36 pm

Re: API v2 .../data/last not working?

by thayes on Thu May 03, 2018 9:50 am

Maybe I just answered my own question. Although it is a public feed I can't request ../data/last without authenticating?

This works and gives me the last point:
https://io.adafruit.com/api/v2/{username}/feeds/{feed_key}/data/last?X-AIO-Key=blah

An unauthenticated user can pull *all* data from a public feed but not individual data points?

thayes
 
Posts: 15
Joined: Mon Apr 04, 2016 5:36 pm

Re: API v2 .../data/last not working?

by cimba007 on Sat Sep 22, 2018 6:02 pm

Ran into the same problem .. still no fix?

cimba007
 
Posts: 2
Joined: Sat Nov 04, 2017 8:46 am

Re: API v2 .../data/last not working?

by brubell on Sun Sep 23, 2018 4:57 pm

You can add support for this using the MQTT /get topic modifier, added to the Adafruit IO Arduino library v2.7.3+: https://io.adafruit.com/blog/notebook/2 ... etain-flag. This feature is compatible with both feeds and group topics: https://github.com/adafruit/Adafruit_IO ... ub.ino#L51

brubell
 
Posts: 185
Joined: Fri Jul 17, 2015 10:33 pm

Please be positive and constructive with your questions and comments.