Skip to content
This repository has been archived by the owner on Mar 3, 2022. It is now read-only.

Feature: Ability to request multiple petitions (by id) in one request #17

Open
BigSauce opened this issue Jun 22, 2013 · 1 comment
Open

Comments

@BigSauce
Copy link

I am developing an iOS app in which the user will watch/favorite many petitions. I need a way to request multiple petitions in one request for easier implementation and less network overhead on We the People's servers.

In my app, there is maintained a list of petition id's which the user is watching. I want to be able to specify multiple id's of the petitions I want in one API request. That way, I won't have to worry about exceeding my 10 request/second limit, and the We the People servers will not be bogged down with around 50 requests each time my users want to view their favorite petitions. Instead, one request would be sent.

An example request may look like the following:
https://api.whitehouse.gov/v1/petitions.json?&id=1234&id=5678.

...or even
https://api.whitehouse.gov/v1/petitions.json.&id=1234%205678

This functionality is critical to the performance of my app.

@roberte3
Copy link

Big Sauce,

Rather than fighting with the API(And worse perhaps ATT's 2g edge network),
there is a simpler way to get the information that you want and you can do
it in two api calls (currently).

If you call this API
https://api.whitehouse.gov/v1/petitions.json?limit=1000&offset=0
Right now the there are 1974 petitions out there so you will need to call
it twice
https://api.whitehouse.gov/v1/petitions.json?limit=1000&offset=1001

And cache that JSON inside of your app, and then query that with
your petition IDs you can quickly determine the status

  • id: "5151eddb2f2c88aa6f000000", is closed with null response. (By far
    my favorite petition ever...)

And because its all stored in your app data cache you can create your views
in milliseconds rather than the tens of seconds on an ATT edge network
in Alabama.

If you take a look at the source code to my iPhone app,
https://github.com/roberte3/wethepeopleapp you can see how I implemented
it using NSArrays stored to the disk, rather than using a SQLite database
or coredata.

Feel free to little r me with any questions or if I can help out with your
app.

-Rob
[email protected]

On Sat, Jun 22, 2013 at 11:32 AM, Big Sauce [email protected]:

I am developing an iOS app in which the user will watch/favorite many
petitions. I need a way to request multiple petitions in one request for
easier implementation and less network overhead on We the People's servers.

In my app, there is maintained a list of petition id's which the user is
watching. I want to be able to specify multiple id's of the petitions I
want in one API request. That way, I won't have to worry about exceeding my
10 request/second limit, and the We the People servers will not be bogged
down with around 50 requests each time my users want to view their favorite
petitions. Instead, one request would be sent.

An example request may look like the following:
https://api.whitehouse.gov/v1/petitions.json?&id=1234&id=5678.

...or even
https://api.whitehouse.gov/v1/petitions.json.&id=1234%205678

This functionality is critical to the performance of my app.


Reply to this email directly or view it on GitHubhttps://github.com//issues/17
.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants