Skip to content

Instantly share code, notes, and snippets.

@grgcombs
Created September 7, 2011 07:37
Show Gist options
  • Save grgcombs/1199988 to your computer and use it in GitHub Desktop.
Save grgcombs/1199988 to your computer and use it in GitHub Desktop.
Open States API examples
/** Open States API - Data for all state legislatures (well, 38 states so far)
* API documentation, method listing, and example GISTs at:
* http://openstates.sunlightlabs.com/api/
*
* Base URL = http://openstates.sunlightlabs.com/api/v1
* NOTE: All GET requests to this base URL must include an 'apikey' query parameter.
*
* My API key looks like this "/districts/tx?apikey=350284d0c6af453b9b56f6c1c7fea1f9"
*
* Resource Path Examples:
*
* /legislators/?state=ny&active=true // list of active legislators in New York
* /legislators/NYL000002 // detail for a particular legislator with this ID
*
* /committees/?state=ny // list of all legislative committees in New York
* /committees/NYC000014 // detail for a particular committee with this ID
*
**/
// LEGISLATOR snippet from: /legislators/NYL000002
{
"id" : "NYL000002",
"leg_id" : "NYL000002",
"state" : "ny",
"chamber" : "upper",
"party" : "Democratic",
"district" : "15",
"full_name" : "Joseph P Addabbo Jr.",
"photo_url" : "http://www.nysenate.gov/files/imagecache/senator_teaser/profile-pictures/Addabbo.SD15.jpg",
"updated_at" : "2011-09-06 06:24:39",
"created_at" : "2011-05-05 01:29:13",
"roles" : [
{
"term" : "2011-2012",
"end_date" : null,
"district" : "15",
"chamber" : "upper",
"state" : "ny",
"party" : "Democratic",
"type" : "member",
"start_date" : null
},
{
"term" : "2011-2012",
"committee_id" : "NYC000001",
"chamber" : "upper",
"state" : "ny",
"subcommittee" : null,
"committee" : "Aging",
"type" : "committee member"
},
{
"term" : "2011-2012",
"committee_id" : "NYC000014",
"chamber" : "upper",
"state" : "ny",
"subcommittee" : null,
"committee" : "Education",
"type" : "committee member"
}
]
}
// COMMITTEE snippet from: /committees/NYC000014
{
"id" : "NYC000014",
"committee" : "Education",
"chamber" : "upper",
"state" : "ny",
"created_at" : "2011-05-05 01:30:48",
"updated_at" : "2011-09-06 06:24:38",
"members" : [
{
"leg_id" : "NYL000002",
"role" : "member",
"name" : "Joseph P. Addabbo Jr"
},
{
"leg_id" : "NYL000004",
"role" : "member",
"name" : "Tony Avella"
},
{
"leg_id" : "NYL000007",
"role" : "member",
"name" : "Neil D. Breslin"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment