We’re celebrating National Democracy Week! Find out more

TheyWorkForYou API
getDebates function

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

Fetch Debates.

This includes Oral Questions.

Arguments

Note you can only supply one of the following search terms at present. If you wish to search multiple things (e.g. date plus person), use the search parameter, and supply query arguments.

type (required)
One of "commons", "westminsterhall", "lords", "scotland", or "northernireland".
date
Fetch the debates for this date.
search
Fetch the debates that contain this term.
person
Fetch the debates by a particular person ID.
gid
Fetch the speech or debate that matches this GID.
order (optional, when using search or person)
d for date ordering, r for relevance ordering.
page (optional, when using search or person)
Page of results to return.
num (optional, when using search or person)
Number of results to return.

Example Response (search)

{
    "info" : {
        "s" : "fish section:lords",
        "results_per_page" : 20,
        "page" : 1,
        "total_results" : 245,
        "first_result" : 1
    },
    "searchdescription" : "containing the word 'fish' in Lords debates",
    "rows" : [{
        "gid" : "2006-07-14a.946.0",
        "hdate" : "2006-07-14",
        "htype" : "12",
        "major" : "101",
        "section_id" : "11432880",
        "subsection_id" : "11432880",
        "relevance" : 17,
        "person_id" : "100176",
        "hpos" : "29",
        "body" : ...
        "listurl" : "/lords/?id=2006-07-14a.901.2&s=fish+section%3Alords#g946.0",
        "speaker" : {
            "member_id" : "100176",
            "title" : "Lord",
            "name" : "Robert Dixon-Smith",
            "house" : "2",
            "constituency" : "",
            "party" : "Conservative",
            "person_id" : "13665",
            "url" : "/peer/?p=100176"
        },
        "parent" : {
            "body" : "Climate Change (EAC Report)"
        }
    },
    {
        "gid" : "2006-07-13a.874.0",
        "hdate" : "2006-07-13",
        "htype" : "12",
        "major" : "101",
        "section_id" : "11432688",
        "subsection_id" : "11432688",
        "relevance" : 28,
        "person_id" : "100549",
        "hpos" : "179",
        "body" : ...
        "listurl" : "/lords/?id=2006-07-13a.871.2&s=fish+section%3Alords#g874.0",
        "speaker" : {
            "member_id" : "100549",
            "title" : "Lord",
            "name" : "Jeff Rooker",
            "house" : "2",
            "constituency" : "",
            "party" : "Labour",
            "person_id" : "10511",
            "url" : "/peer/?p=100549",
            "office" : [{
                "dept" : "Department for Environment, Food and Rural Affairs",
                "position" : "Minister of State (Sustainable Farming and Food)",
                "pretty" : "Minister of State (Sustainable Farming and Food), Department for Environment, Food and Rural Affairs"
            }]
        },
        "parent" : {
            "body" : "Northern Ireland (Miscellaneous Provisions) Bill"
        }
    },
    ...

Explorer

Try out this function without writing any code!

type:
date:
search:
person:
gid:
year:
order:
page:
num:
Output: