Closed liamnichols closed 8 years ago
@liamnichols we haven't written any formal documentation yet but essentially the /petitions.json
and /petitions/:id.json
HTTP endpoints are probably what you're looking for. There's no authentication required for accessing the API. There's also no rate limiting since it's read-only but that may change if it gets abused (probably will happen at some point).
Ah, thanks for getting back to me... I found those, but also noticed that there were various query parameters that could be passed to filter the content and was wondering if they were documented?
I guess I could look through the source code to figure all this out but i'm more of a mobile developer so i'm not that familiar with it all...
Also, are you able to sign petitions or create new ones via the API?
Liam
@liamnichols there are 3 query parameters which can be passed to /petitions.json
- they are:
Also, are you able to sign petitions or create new ones via the API?
Not currently, for obvious reasons that it would make it easier for people to script signing and petition creation. Also it could be abused to make people sign a petition thinking one thing whereas it was another petition entirely so we want to control what people see when signing for their protection.
What is the likelihood of a post endpoint being opened up in the future?
@gazzwi86 pretty much zero – the potential for abuse is too great. What use did you have in mind?
On a similar topic, are you planning to expose anything for the "trending" petitions? I'm interested in data vis stuff, and this would be useful for me. @henryhadlow
It would be pretty simple to add an API endpoint for trending petitions - just a matter of taking the query from the homepage and generating some JSON. Maybe it'd be better to just do a JSON template for the home page?
@pixeltrix - Something which might offer more utility could be to accept date range params on /petitions.json ?
@en-rphillips what use for this functionality did you have in mind?
@henryhadlow I would like to show petition signing trends when mapped against news events (targeted roughly with date ranges).
e.g. after trump wins iowa - petition to bar trump from uk get's signed 200k+ times in 24hrs
at the moment my list of petitions always has the same popular stuff at the top
That would be pretty interesting. That would require trending petitions over time. Probably just volume of signatures over time for each petition would be more generally useful. I'll look into the priority of this against other stuff we want to look at.
On 31 March 2016 at 14:29, Rob Phillips notifications@github.com wrote:
@henryhadlow https://github.com/henryhadlow I would like to show petition signing trends when mapped against news events (targeted roughly with date ranges).
e.g. after trump wins iowa - petition to bar trump from uk get's signed 200k+ times in 24hrs
at the moment my list of petitions always has the same popular stuff at the top
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/alphagov/e-petitions/issues/417#issuecomment-203935924
Henry Hadlow Product Manager GOV.UK Notify https://www.gov.uk/government/publications/govuk-notify/govuk-notify • petition.parliament.uk Government Digital Service https://gds.blog.gov.uk/
This isn't really an issue, but more of a question..
I understand there is a REST API available for the website however I can't seem to find any documentation around the API... Is this available somewhere?
If it was in a really obvious place then my bad but if not then maybe it would be a good idea to provide a developer portal or some help pages referencing to it?
Thanks, Liam