Legislators.allForZip

From Sunlabs wiki

Jump to: navigation, search


legislators.allForZip is a shortcut method that returns all legislators that currently represent some portion of a zipcode. Typically this means it will return two senators and one or more representatives. This is the same data that could be retrieved by using districts.getDistrictsFromZip in combination with legislators.get and getList.

This method was added simply because it seems to be a common pattern to want all of a user's representation.

Contents

Parameters

The only parameter accepted by legislators.allForZip is the zip parameter which should be a five digit zip code.

Return Value

Legislators are returned either in XML or JSON with all of the fields listed below:

Fields

The same fields are returned for a legislator that are returned by legislators.get and getList

Example Calls

legislators.allForZip.json?zip=27511

{"response":
    {"legislators": [
        
        {"legislator": {"district": "4", "title": "Rep", "eventful_id": "P0-001-000016562-5", "in_office": 1,
        "state": "NC", "votesmart_id": "119", "party": "D", "email": "", "crp_id": "N00002260", "website": "http://price.house.gov/",
        "fax": "202-225-2014", "govtrack_id": "400326", "firstname": "David", "middlename": "Eugene", "lastname": "Price",
        "congress_office": "2162 Rayburn House Office Building", "bioguide_id": "P000523", "webform": "http://price.house.gov/contact/contact_form.shtml",
        "nickname": "", "phone": "202-225-1784", "fec_id": "H6NC04037", "gender": "M", "name_suffix": "", "twitter_id": "", "sunlight_old_id": "fakeopenID319",
        "congresspedia_url": "http://www.sourcewatch.org/index.php?title=David_Price"}},
        
        {"legislator": {"district": "Senior Seat", "title": "Sen", "eventful_id": "P0-001-000016060-2", "in_office": 1, "state": "NC", "votesmart_id": "41533",
        "party": "R", "email": "", "crp_id": "N00008071", "website": "http://dole.senate.gov", "fax": "202-224-1100", "govtrack_id": "300035",
        "firstname": "Elizabeth", "middlename": "H.", "lastname": "Dole", "congress_office": "555 Dirksen Office Building", "bioguide_id": "D000601",
        "webform": "http://dole.senate.gov/public/index.cfm?FuseAction=ContactInformation.ContactForm", "nickname": "", "phone": "202-224-6342", "fec_id": "S2NC00083",
        "gender": "F", "name_suffix": "", "twitter_id": "", "sunlight_old_id": "fakeopenID468", "congresspedia_url": "http://www.sourcewatch.org/index.php?title=Elizabeth_Dole"}},
        
        {"legislator": {"district": "13", "title": "Rep", "eventful_id": "P0-001-000016512-0", "in_office": 1, "state": "NC", "votesmart_id": "10205", "party": "D",
        "email": "", "crp_id": "N00025093", "website": "http://www.house.gov/bradmiller/", "fax": "202-225-0181", "govtrack_id": "400280", "firstname": "Ralph",
        "middlename": "Bradley", "lastname": "Miller", "congress_office": "1722 Longworth House Office Building", "bioguide_id": "M001154",
        "webform": "http://bradmiller.house.gov/?sectionid=17&sectiontree=9,17", "nickname": "Brad", "phone": "202-225-3032", "fec_id": "H2NC13029", "gender": "M",
        "name_suffix": "", "twitter_id": "", "sunlight_old_id": "fakeopenID275", "congresspedia_url": "http://www.sourcewatch.org/index.php?title=Brad_Miller"}},
        
        {"legislator": {"district": "Junior Seat", "title": "Sen", "eventful_id": "P0-001-000016040-8", "in_office": 1, "state": "NC", "votesmart_id": "21787",
        "party": "R", "email": "", "crp_id": "N00002221", "website": "http://burr.senate.gov/", "fax": "202-228-2981", "govtrack_id": "400054",
        "firstname": "Richard", "middlename": "M.", "lastname": "Burr", "congress_office": "217 Russell Senate Office Building", "bioguide_id": "B001135",
        "webform": "http://burr.senate.gov/public/index.cfm?FuseAction=Contact.Home", "nickname": "", "phone": "202-224-3154", "fec_id": "S4NC00089",
        "gender": "M", "name_suffix": "", "twitter_id": "", "sunlight_old_id": "fakeopenID449", "congresspedia_url": "http://www.sourcewatch.org/index.php?title=Richard_Burr"}}
    ]
}}

legislators.allForZip.xml?zip=27511

<response>
  <legislators>
  <legislator>
    <district>4</district>
    <title>Rep</title>
    <eventful_id>P0-001-000016562-5</eventful_id>
    <in_office>1</in_office>
    <state>NC</state>
    <votesmart_id>119</votesmart_id>
    <party>D</party>
    <email/>
    <crp_id>N00002260</crp_id>
    <website>http://price.house.gov/</website>
    <fax>202-225-2014</fax>
    <govtrack_id>400326</govtrack_id>
    <firstname>David</firstname>
    <middlename>Eugene</middlename>
    <lastname>Price</lastname>
    <congress_office>2162 Rayburn House Office Building</congress_office>
    <bioguide_id>P000523</bioguide_id>
    <webform>http://price.house.gov/contact/contact_form.shtml</webform>
    <nickname/>
    <phone>202-225-1784</phone>
    <fec_id>H6NC04037</fec_id>
    <gender>M</gender>
    <name_suffix/>
    <twitter_id/>
    <sunlight_old_id>fakeopenID319</sunlight_old_id>
    <congresspedia_url>
    http://www.sourcewatch.org/index.php?title=David_Price
    </congresspedia_url>
  </legislator>
  <legislator>
    <district>Senior Seat</district>
    <title>Sen</title>
    <eventful_id>P0-001-000016060-2</eventful_id>
    <in_office>1</in_office>
    <state>NC</state>
    <votesmart_id>41533</votesmart_id>
    <party>R</party>
    <email/>
    <crp_id>N00008071</crp_id>
    <website>http://dole.senate.gov</website>
    <fax>202-224-1100</fax>
    <govtrack_id>300035</govtrack_id>
    <firstname>Elizabeth</firstname>
    <middlename>H.</middlename>
    <lastname>Dole</lastname>
    <congress_office>555 Dirksen Office Building</congress_office>
    <bioguide_id>D000601</bioguide_id>
    <webform>
    http://dole.senate.gov/public/index.cfm?FuseAction=ContactInformation.ContactForm
    </webform>
    <nickname/>
    <phone>202-224-6342</phone>
    <fec_id>S2NC00083</fec_id>
    <gender>F</gender>
    <name_suffix/>
    <twitter_id/>
    <sunlight_old_id>fakeopenID468</sunlight_old_id>
    <congresspedia_url>
    http://www.sourcewatch.org/index.php?title=Elizabeth_Dole
    </congresspedia_url>
  </legislator>
  <legislator>
    <district>13</district>
    <title>Rep</title>
    <eventful_id>P0-001-000016512-0</eventful_id>
    <in_office>1</in_office>
    <state>NC</state>
    <votesmart_id>10205</votesmart_id>
    <party>D</party>
    <email/>
    <crp_id>N00025093</crp_id>
    <website>http://www.house.gov/bradmiller/</website>
    <fax>202-225-0181</fax>
    <govtrack_id>400280</govtrack_id>
    <firstname>Ralph</firstname>
    <middlename>Bradley</middlename>
    <lastname>Miller</lastname>
    <congress_office>1722 Longworth House Office Building</congress_office>
    <bioguide_id>M001154</bioguide_id>
    <webform>
    http://bradmiller.house.gov/?sectionid=17&sectiontree=9,17
    </webform>
    <nickname>Brad</nickname>
    <phone>202-225-3032</phone>
    <fec_id>H2NC13029</fec_id>
    <gender>M</gender>
    <name_suffix/>
    <twitter_id/>
    <sunlight_old_id>fakeopenID275</sunlight_old_id>
    <congresspedia_url>
    http://www.sourcewatch.org/index.php?title=Brad_Miller
    </congresspedia_url>
  </legislator>
  <legislator>
    <district>Junior Seat</district>
    <title>Sen</title>
    <eventful_id>P0-001-000016040-8</eventful_id>
    <in_office>1</in_office>
    <state>NC</state>
    <votesmart_id>21787</votesmart_id>
    <party>R</party>
    <email/>
    <crp_id>N00002221</crp_id>
    <website>http://burr.senate.gov/</website>
    <fax>202-228-2981</fax>
    <govtrack_id>400054</govtrack_id>
    <firstname>Richard</firstname>
    <middlename>M.</middlename>
    <lastname>Burr</lastname>
    <congress_office>217 Russell Senate Office Building</congress_office>
    <bioguide_id>B001135</bioguide_id>
    <webform>
    http://burr.senate.gov/public/index.cfm?FuseAction=Contact.Home
    </webform>
    <nickname/>
    <phone>202-224-3154</phone>
    <fec_id>S4NC00089</fec_id>
    <gender>M</gender>
    <name_suffix/>
    <twitter_id/>
    <sunlight_old_id>fakeopenID449</sunlight_old_id>
    <congresspedia_url>
    http://www.sourcewatch.org/index.php?title=Richard_Burr
    </congresspedia_url>
  </legislator>
</legislators>
</response>
Personal tools