michaelmulley / openparliament

Keeping tabs on Canada's Parliament
http://openparliament.ca/
GNU Affero General Public License v3.0
265 stars 42 forks source link

Time filter #45

Closed kctdfh closed 7 years ago

kctdfh commented 7 years ago

Hey!

I'm trying to filter my query with a time_range so that I can only return the debate text of a section of the proceedings, based on the day's agenda but the time_range filter doesn't seem to be working.

For example, this doesn't work: https://api.openparliament.ca/speeches/?document=%2Fdebates%2F2017%2F5%2F17%2F&time=time__range%3D2012-10-19+10%3A00%2C2012-10-19+11%3A00

That API call was built using the example for the time field. I copy pasted it verbatim but it doesn't work.

The following formats work (as one would expect) but I had no luck making range work

2012-09-04 06:00
2012-09-04 06:00:00
2012-09-04 06:00:00.000000
2012-09-04 06:00Z
2012-09-04 06:00:00+0800
2012-09-04 06:00:00.000000-08:00

michaelmulley commented 7 years ago

Ah, yes, the pitfalls of really terse documentation. Sorry!

The answer is that time__range should be the name of the querystring parameter, not time. So the URL would be http://api.openparliament.ca/speeches/?time__range=2012-10-19+10%3A00%2C2012-10-19+11%3A00

I agree this is very much non-obvious. Will think about how to indicate this better.

(And if you're doing this for a project that'll be publically accessible, please let me know when it's done!)