Data.parliament.uk

Data.parliament.uk

Government

Contains live datasets including information about petitions, bills, MP votes, attendence, and more. Data.parliament application programming interface (API) enables you to embed and use their data in your applications. This allows you to 1) Offer a rich set of parliamentary open data directly to your customers. 2) Build highly functional data-driven applications. 3) Analyze and interpret the data. 4) Link data to other open data sources such as DBpedia. There are two ways of retrieving data from the platform. 1) Retrieving data by consuming atom feeds and resources using the Feed APIs. 2) Retrieving data by calling the Linked Data APIs. The API calls returns XML and JSON formats.

Visit API🔁 Alternatives

📚 Documentation & Examples

Everything you need to integrate with Data.parliament.uk

🚀 Quick Start Examples

Data.parliament.uk Javascript Examplejavascript
// Data.parliament.uk API Example
const response = await fetch('http://www.data.parliament.uk/developers/', {
    method: 'GET',
    headers: {
        'Content-Type': 'application/json'
    }
});

const data = await response.json();
console.log(data);

Accessing UK Parliament Data with the Parliament API

If you're looking for data on the UK Parliament, the Parliament API is the perfect solution. It offers a wide range of data - from information on Members of Parliament to details about House of Commons business.

To get started with the Parliament API, simply head to http://www.data.parliament.uk/developers/ and sign up for an API key. Once you have your key, you can start making requests to the API and receiving data in return.

Using JavaScript to Access the Parliament API

To make requests to the Parliament API using JavaScript, you'll need to use a library like axios or fetch. Here are some example code snippets to help you get started:

Get information about a specific Member of Parliament

const axios = require('axios');

const API_KEY = 'YOUR_API_KEY';

axios.get(`http://api.data.parliament.uk/members/${memberId}.json`, {
  params: {
    apikey: API_KEY,
  }
})
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error(error);
  });

Get a list of all written answers to parliamentary questions

const axios = require('axios');

const API_KEY = 'YOUR_API_KEY';

axios.get('http://api.data.parliament.uk/writtens/search.json', {
  params: {
    apikey: API_KEY,
  }
})
  .then(response => {
    console.log(response.data.items);
  })
  .catch(error => {
    console.error(error);
  });

Get the latest business in the House of Commons

const axios = require('axios');

const API_KEY = 'YOUR_API_KEY';

axios.get('http://api.data.parliament.uk/calendar.json', {
  params: {
    apikey: API_KEY,
    house: 'commons',
  },
})
  .then(response => {
    const latestBusiness = response.data[0];
    console.log(latestBusiness.title);
  })
  .catch(error => {
    console.error(error);
  });

Conclusion

The Parliament API is an incredibly useful resource for anyone looking to work with data on the UK Parliament. With a little bit of JavaScript, you can easily make requests to the API and receive data in return. Try it out for yourself and start building amazing applications powered by parliamentary data.

📊 30-Day Uptime History

Daily uptime tracking showing online vs offline minutes

Aug 5Aug 7Aug 9Aug 11Aug 13Aug 15Aug 17Aug 19Aug 21Aug 23Aug 25Aug 27Aug 29Aug 31Sep 304008001440Minutes
Online
Offline

Related APIs in Government