A .NET wrapper for the Sunlight Foundation Open States API (http://openstates.org/api).
I created this wrapper for another project I'm working on. It does not currently implement all of the available methods in the Open States API. I'm implementing them as needed.
The Open States data comes from scraping the websites of various state legislatures. Scraping a website for data is very brittle so there will be mistakes and inconsistencies.
You will need an API key to work with the Open States API. One can be obtained from http://sunlightfoundation.com/api/.
using(var client = new OpenStatesClient("YourOpenStatesApiKey"))
{
// You can search for legislators using various parameters. All parameters are optional.
// This example searches for all Republican members of the Utah State Senate.
var republicanSenators = client.LegislatorSearch(
state: State.UT,
chamber: Chamber.Upper,
party: "Republican"
);
// Retrieve legislators who are serving districts containing the given coordinates.
var legislatorsByCoordinates = client.LegislatorsGeoLookup(41.082303, -111.996914);
// Retrieve information on all Utah Senate districts.
var senateDistricts = client.DistrictSearch(State.UT, Chamber.Upper);
// Retrieve detailed geographical boundary information for the given district.
var districtBoundary = client.DistrictBoundaryLookup("sldl/ut-22");
}
Metadata methods- Bill methods
Legislator methodsCommittee methods- (thanks @pcopley)- Event methods
District methods
This package is available on NuGet.
Install-Package OpenStates-CS