TheyWorkForYou API
getMPs function

https://www.theyworkforyou.com/api/getMPs

Fetch a list of MPs.

Note that during the period before a general election when there are no MPs, this call will correctly return no results for a default (today) lookup.

Arguments

date (optional)
Fetch the list of MPs as it was on this date.
party (optional)
Fetch the list of MPs from the given party.
search (optional)
Fetch the list of MPs that match this search string in their name.

Example Response, serialised PHP

a:646:{
    i:0; a:5:{
        s:9:"member_id"; s:4:"1368";
        s:9:"person_id"; s:5:"10900";
        s:4:"name"; s:13:"Hywel Francis";
        s:5:"party"; s:6:"Labour";
        s:12:"constituency"; s:8:"Aberavon";
    }
    i:1; ...

Explorer

Try out this function without writing any code!

party:
date:
search:
Output: