Skip to content

Legislation

Matt Farmer edited this page Aug 9, 2013 · 5 revisions

The Legislation Resource provides information on legislation from both the House and Senate. It is possible to retrieve items of legislation by its ObjectID or by its legislation number (one of "HB, "HR", "SB", "SR", followed by a number... eg "HB1" or "SR23"). If you use the legislation number, the API will assume the current session unless one is provided.

Legislation Model

Field Description
_id The unique Object ID of the legislation in the API's database.
sessionId The ObjectId of the legislative session in which the legislation occurred.
code The legislation code. E.g. "HB1".
chamber One of "house" or "senate".
type One of "bill" or "resolution".
number The number of this chamber and type in the session.
title The title of the legislation.
sponsors Members sponsoring the bill.
committees An array of Committees associated with the bill.
summary Summary of the legislation.
history A map of status changes to the bill, keyed on the date of change with values being strings indicating the type of status change.
footnotes A string indicating any footnotes on the bill.
versions A map of URLs to PDF versions of the full legislation. Keyed on the name of the version, with values being URLs. The current version will always be named "Current".

GET /api/v1/legislation

This API call will retrieve a list of all legislation from both chambers in the current session. It takes the following items as parameters:

  • sessionId (Session ID) - The object ID of the legislative session for which you would like legislation. If not provided, defaults to the ID of the current session.
  • sponsorId (Person ID) - Matches all legislation where the person represented by this ID is listed as a sponsor.
  • committeeId (Committee ID) - Matches all legislation where the committee indicated by this ID is listed as a committee assigned to the legislation.
  • chamber (String) - To limit your search to a particular chamber, provide the string "house" or the string "senate" in this parameter.
  • introducedBefore (Date) - Matches all legislation whose first status is on or before the date specified.
  • introducedAfter (Date) - Matches all legislation whose first status is on or after the date specified.
  • updatedBefore (Date) - Matches all legislation whose most recent status is on or before the date specified.
  • updatedAfter (Date) - Matches all legislation whose most recent status is on or after the date specified.

Response

On success, if results were found you will receive an HTTP 200 response, with a JSON array containing JSON objects that tell you the unique ID of the legislation, the session ID, the code, and the title. Like so:

[
  {"_id": "abcabcabcabc", "sessionId": "defdefdefdef", "code": "HB1", "title": "Some title."},
  {"_id": "cececececece", "sessionId": "efefefefefef", "code": "SR1", "title": "Some title 2."}
]

In the event there were no matches for your query, you'll receive an HTTP 204 response with no body. In the event there was a problem processing your response, you'll receive an error formatted like those in the Error Handling page, depending on what went wrong.

GET /api/v1/legislation/:id

This API call will return full information on a specific piece of legislation. To retrieve this information replace :id above with the unique ID of the legislation in our database (the _id attribute). On success, the result will be a JSON object that contains every attribute of the model outlined above.

In the event we can't find a matching pieces of legislation for that ID, we'll return a 404. If something goes seriously wrong, you'll get an error like those outlined in Error Handling.

GET /api/v1/legislation/hb/:number

This API call will attempt to find a house bill with the particular number you specify for :number in the current legislative session. If you would like to find such a house bill in a different session, provide a sessionId query parameter with the unique ID of the session. If we find a matching house bill, we'll return the full JSON representation of the legislation.

In the event we can't find a house bill of that number in the current session (or session you specify if you provide sessionId), we'll return a 404. If something seriously goes wrong, you'll get an error like those outlined in Error Handling.

GET /api/v1/legislation/hr/:number

Works exactly like the call for House Bills above, except this one finds House Resolutions.

GET /api/v1/legislation/sb/:number

Works exactly like the call for House Bills above, except this one finds Senate Bills.

GET /api/v1/legislation/sr/:number

Works exactly like the call for House Bills above, except this one finds Senate Resolutions.