TheyWorkForYou API
getMP function

http://www.theyworkforyou.com/api/getMP

Fetch a particular MP.

Arguments

postcode (optional)
Fetch the MP for a particular postcode (either the current one, or the most recent one, depending upon the setting of the always_return variable. This will only return their current/ most recent entry in the database, look up by ID to get full history of a person.
constituency (optional)
The name of a constituency; we will try and work it out from whatever you give us. :) This will only return their current/ most recent entry in the database, look up by ID to get full history of a person.
id (optional)
If you know the person ID for the member you want (returned from getMPs or elsewhere), this will return data for that person. This will return all database entries for this person, so will include previous elections, party changes, etc.
always_return (optional)
For the postcode and constituency options, sets whether to always try and return an MP, even if the seat is currently vacant (due to e.g. the death of an MP, or the period before an election when there are no MPs).

Example Response

[{
  "member_id" : "1368",
  "house" : "1",
  "first_name" : "Hywel",
  "last_name" : "Francis",
  "constituency" : "Aberavon",
  "party" : "Labour",
  "entered_house" : "2005-05-05",
  "left_house" : "9999-12-31",
  "entered_reason" : "general_election",
  "left_reason" : "still_in_office",
  "person_id" : "10900",
  "title" : "",
  "lastupdate" : "2008-02-26 22:25:20",
  "full_name" : "Hywel Francis",
  "url" : "/mp/hywel_francis/aberavon",
  "image" : "/images/mps/10900.jpg",
  "image_height" : 59,
  "image_width" : 49,
  "office" : [{
  "moffice_id" : "4949210",
  "dept" : "Liaison Committee",
  "position" : "",
  "from_date" : "2005-11-01",
  "to_date" : "9999-12-31",
  "person" : "10900",
  "source" : "chgpages/selctee"
},
{
  "moffice_id" : "4949211",
  "dept" : "Welsh Affairs Committee",
  "position" : "Chairman",
  "from_date" : "2005-11-01",
  "to_date" : "9999-12-31",
  "person" : "10900",
  "source" : "chgpages/selctee"
}]
},
{
  "member_id" : "900",
  "house" : "1",
  "first_name" : "Hywel",
  "last_name" : "Francis",
  "constituency" : "Aberavon",
  "party" : "Labour",
  "entered_house" : "2001-06-07",
  "left_house" : "2005-04-11",
  "entered_reason" : "general_election",
  "left_reason" : "general_election_standing",
  "person_id" : "10900",
  "title" : "Mr",
  "lastupdate" : "2009-05-19 23:24:40",
  "full_name" : "Mr Hywel Francis",
  "url" : "/mp/mr_hywel_francis/aberavon",
  "image" : "/images/mps/10900.jpg",
  "image_height" : 59,
  "image_width" : 49
}]

Explorer

Try out this function without writing any code!

id:
constituency:
postcode:
always_return:
extra:
Output: