Our website has detected that you are using a browser that is not supported.
This may prevent you from accessing certain features.
We strongly recommend you use an alternative browser.
We have fully test this site on both Chrome and Firefox. Which are available for download here
X

Last Reading Date

07 Feb, 2017 17:37
Hi there

How can I get the last reading date and time of a specific sensor?

I couldn't find this info in the documentation and I was wondering if someone could help smile

Thanks

Silvia
08 Feb, 2017 11:30
Hi

I'm not sure this is available at the moment but if not I'll add this functionality then let you know.

Cheers

Neil (UO)
08 Feb, 2017 14:59
Hi Neil

Thanks for your reply. It seems that the only way to get the number of available parking spaces (from the Bank foot metro sensor) is to access it through the last reading date.

For example, if we consider API call
http://uoweb1.ncl.ac.uk/api/v1/sensor/data/raw.json?sensor_name=Bank%20Foot%20Metro%20Bank%20Foot%20Metro&start_time=20170208143712&end_time=20170208144712&api_key=myapikey

I get the below JSON object in response:

[{"type": "Parking", "source": {"db_name": "car_park.rss", "fancy_name": "Newcastle Council RSS feed", "web_display_name": "Newcastle Council RSS feed (Third Party)", "document": "", "third_party": true}, "geom": {"type": "Point", "coordinates": [-1.61778, 54.978252]}, "active": "True", "name": "Bank Foot Metro Bank Foot Metro", "data": {"Parking Spaces": {"data": {"[2017-02-08 14:43:59": 18.0, "2017-02-08 14:38:49": 17.0}, "meta": {"name": "Parking Spaces", "theme": "Traffic", "units": "Cars"}}, "Cars": {"data": {"2017-02-08 14:43:59": 44.0, "2017-02-08 14:38:49": 45.0}, "meta": {"name": "Cars", "theme": "Traffic", "units": "Cars"}}}}]

If I want to access the available parking spaces (17.0) in "data": "Parking Spaces", I believe I need the last reading date. But maybe there's another way of doing this?

Thanks

Regards,
Silvia
08 Feb, 2017 15:06
Hi Silvia

There is a way live data for a selection of sensors but not an individual sensor. I'll ad this is now and get back to you.

Cheers

Neil (UO)
08 Feb, 2017 15:18
I've now implemented this. have a try of the below api call

http://uoweb1.ncl.ac.uk/api/v1/sensor/live.json?sensor_name=Bank%20Foot%20Metro%20Bank%20Foot%20Metro&api_key=myapikey

Cheers

Neil (UO)
08 Feb, 2017 15:29
Hi Neil

Thanks for this.

Has the change been deployed already? I've tried the above API call but I get the same JSON object as before in response.

[{"name": "Bank Foot Metro Bank Foot Metro", "source": {"web_display_name": "Newcastle Council RSS feed (Third Party)", "fancy_name": "Newcastle Council RSS feed", "document": "", "db_name": "car_park.rss", "third_party": true}, "type": "Parking", "active": "True", "data": {"Cars": {"meta": {"name": "Cars", "units": "Cars", "theme": "Traffic"}, "data": {"2017-02-08 15:18:54": 40.0}}, "Parking Spaces": {"meta": {"name": "Parking Spaces", "units": "Cars", "theme": "Traffic"}, "data": {"2017-02-08 15:18:54": 22.0}}}, "geom": {"type": "Point", "coordinates": [-1.61778, 54.978252]}}]

Cheers

Silvia
08 Feb, 2017 15:42
The above api call will always give you the latest readings for the sensor.

I have now also included the latest reading in the sensor json.

Cheers

Neil (UO)
08 Feb, 2017 15:54
Brilliant! Thanks for your help.
 
Register or login to create to post a reply.