-
Notifications
You must be signed in to change notification settings - Fork 2
Rest API
Build with the AsqUs platform. Integrate deeply into our network of engaged citizens and attentive representatives.
The REST API lets you interact with AsqUs over HTTP. There are many things you can do with the REST API. Applications written in any language can make use of AsqUs data.
Each request can have optional parameters.
Optional
- version - Default: latest version. It's a good idea to specify the version, as our API will be changing rapidly. The current version is in the title of this page.
- limit [coming soon] - Integer for the amount of objects received in the response.
- page [coming soon] - Used for request pagination.
GET /users
http://asq.us/users.json
- Auth required: no
GET /users/[user_id]
http://asq.us/users/1.json
- Auth required: no
GET /users/[user_id]/reps
http://asq.us/users/1.json
- Fetch representatives for a given user.
- Auth required: no
GET /polls
http://asq.us/polls.json
- Array of all polls
- Auth required: no
- Response field votes_per_day: see method /polls/votes_per_day below.
GET /polls/[poll_id]
http://asq.us/polls/5.json
- Fetch given poll
- Auth required: no
- Response field votes_per_day: see method /polls/votes_per_day below.
GET /polls/[poll_id]/totals
http://asq.us/polls/5/totals.json
- Response:
[ { "option": "Yes", "count": 78 }, { "option": "No", "count": 13 } ]
GET /polls/[poll_id]/vote/[option_id]
http://asq.us/polls/5/vote/1.json
- Auth required: yes
- option_id here is the zero-based ID of the desired vote for the options array of the poll object. To retrieve the options array, first fetch the poll object using /polls or /poll/[poll_id].
- Response:
[ { count: 73, option: "Yes" }, { count: 13, option: "No" } ]
GET /polls/[poll_id]/votes_per_day
http://asq.us/polls/5/votes_per_day.json
- Array of Unix epoch timestamp + count pairs, where count is the number of votes on the poll during that day.
- Auth required: no
- Response:
[ [1287903600, 79], [1287990000, 25], [1288076400, 61] ]
GET /polls/for_user
http://asq.us/polls/for_user.json?user_id=55
- Auth required: no
- Required: user_id
Certain resources in the AsqUs API refer to a state_id. Use this these API methods to convert between an AsqUs State ID and its standard name and abbreviation.
GET /states
http://asq.us/states.json
- Auth required: no
GET /states/[state_id]
http://asq.us/states/1.json
- Required: state_id, which is the AsqUs ID for a state or province. You can look this up using /states/by_abbreviation.
- Auth required: no
GET /states/by_abbreviation
http://asq.us/states/by_abbreviation.json?abbreviation=NY
- Required: abbreviation, which is the standard, two-letter postal abbreviation for the state or province.
- Auth required: no