-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to query last Observations for Thing in single GET? #145
Comments
something like this? |
Getting only the last observation for a thing is not possible, you can however request the related datastreams and the latest observation for the datastream. Example GET a list of Things based on a property with expanded datastreams and last observation:
You can findout more about SensorThings and ODATA here: https://gost1.docs.apiary.io/#reference/odata |
Thanks for the quick responses! I've adapted the SE STA Cookbook after experimenting with various GET options. Example 1Get the last Example 2Using Somehow the part |
It's possible that some queries do not work on version 0.5, latest version has better query support. |
Ok, I see e.g. #129 fixed separated inline options. One last Thing: need to find a query to get all Observations related to single Thing for time interval in particular last 48 hours. Tried ISO 8601 intervals without success. This ( but how to realize for single |
Should be something like
however, I found a problem with parsing of string/date/time on inline queries, I'm looking into it now |
Yes, I tried similar |
Using ISO 8601 strings should also be fine I just used date() as an example, The odata code is now updated to get the mentioned example working, strings weren't parsed properly inside $expand queries. There is still some work to do to get all queries working inside the $expand operation, an issue is created for this: #147 |
Tried Only this returns Also in theory getting the last Observations for a time period works, but with same |
Related to issue #146, should be fixed. We are aware of possible complications around not having a nextlink on expanded entity arrays, the STA standard does not specify this and is indeed complicated to implement, however we are planning to implement this and making this an optional feature in the feature. |
Did not find a public STA mailing list, so posing the question here: need to get the last
Observations
for a singleThing
(or better from a series ofThings
from aproperties.project
query). Question was posed on our SE issue tracker:smartemission/smartemission#79
Started a SE STA Cookbook where I will add any recipes.
I know this can be solved in multiple steps:
Things
with$expand
edDatastreams
Datastream
GET the lastObservation
(think$top=1
)But I am seeking to do the 2nd step in one GET. Scenario: typically a web viewer that shows a map with AQ Stations, clicking on a Station will show all last station's last sensor (
Observation
) values. Example: http://data.smartemission.nl/smartapp/.The text was updated successfully, but these errors were encountered: