Skip to content
This repository has been archived by the owner on Feb 1, 2020. It is now read-only.

Differences between the API and MongoDB

jpmckinney edited this page Apr 20, 2013 · 13 revisions

The JSON downloads are in the same format as the API and are usually created on the first day of each month with the billy-util dumpjson command without the --novalidate switch. You can get the date and URL of the latest JSON dump of each state via the API, for example:

http://openstates.org/api/v1/metadata/?fields=latest_json_url,latest_json_date&apikey=API_KEY

General differences

  • API renames _id to id
  • Removes all underscore fields like _all_ids. You can't add these back with the fields query string parameter.
  • Votes are only available through bills.
  • Subjects are not available through the API.

Metadata

  • By default, removes id, legislature_name, capitol_timezone, latest_update, terms, session_details, latest_json_url, latest_json_date, latest_csv_url, latest_csv_date, legislature_url and capitol_maps
  • By default, adds lower_chamber_name, lower_chamber_title, upper_chamber_name and upper_chamber_title, and lower_chamber_term and upper_chamber_term if available

Bills

Legislators

  • By default, removes roles, old_roles and sources

Committees

  • By default, returns only id, state, chamber, committee, subcommittee, parent_id, created_at and updated_at. You can add fields using the fields query string parameter. To get all the fields except for +plus fields and country and level (which are always us and state if set), use:

    fields=members,parent_id,state,chamber,committee,subcommittee,sources,created_at,updated_at

  • No discernible difference

Districts

  • Adds a legislators field with an array of objects with leg_id and full_name fields
  • Adds bbox, region and shape fields

Events

The Events API lacks the following documentation:

  • dtstart: search for events with a when after dtstart, in the format YYYY-MM-DD, defaults to a week ago
  • dtend: search for events with a when before dtstart, in the format YYYY-MM-DD
  • A maximum of 1000 events are returned. In order to retrieve all events, you must change the size of the time window set by dtstart and dtend until under 1000 events are returned, then proceed to the next time window and repeat. The first window is dtstart=1900-01-01&dtend=2010-12-01. Good luck!
Clone this wiki locally