-
Notifications
You must be signed in to change notification settings - Fork 78
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
Order option for records returned by petitions.json? #773
Comments
Hi Jim, Sorry for the delayed reply - there isn't currently an option to specify an arbitrary sort order as we try to optimise our database queries so that indexes are used all the time. However we might consider adding a specific limited set of custom sort orders to our JSON api requests to allow researchers to get easier access to data. Do you have a particular use case? |
Hi Andrew,
Thanks for your reply.
When I found out petition data could be accessed via JSON I set up a simple
page to look pull data from the API (https://jimpix.co.uk/petitions/). The
page isn't used by anyone except me, I was just tinkering and enjoyed being
able to work with the data returned by the API.
When returning data e.g. open petitions, via
https://petition.parliament.uk/petitions.json?page=1&state=open, it's not
clear what the default sort order is, and I thought it'd be useful to be
able to sort by created_at, or signature_count (ascending and descending
for both).
Same on the search - if it was possible to sort search results returned by
e.g. https://petition.parliament.uk/petitions.json?q=tree&page=1&state=open
that would be very useful.
If that counts as a use case, then I hope that provides some more
background / info.
Thanks again
Jim
…On Mon, 19 Apr 2021 at 13:21, Andrew White ***@***.***> wrote:
Hi Jim,
Sorry for the delayed reply - there isn't currently an option to specify
an arbitrary sort order as we try to optimise our database queries so that
indexes are used all the time. However we might consider adding a specific
limited set of custom sort orders to our JSON api requests to allow
researchers to get easier access to data. Do you have a particular use case?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#773 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APW4KK6UD7EKGAVZQVY75QTTJQN5TANCNFSM4V7XRZPQ>
.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently I can search for
bees
in the list of rejected petitions via the following:https://petition.parliament.uk/petitions.json?q=bees&page=1&state=rejected
Or list debated petitions via:
https://petition.parliament.uk/petitions.json?page=1&state=debated
I wondered if there is any additional parameter which can be passed to the search URL to allow results to be sorted by e.g. creation date, either ascending or descending?
I have searched first before raising this question but couldn't see anything, so maybe it's not an option?
Thanks
Jim
The text was updated successfully, but these errors were encountered: