Tools for advanced users and coders
This page explains how developers can access data from WhatDoTheyKnow, or allow other websites and software to interact with the site via an “API”.
WhatDoTheyKnow does not have a full API, but we are gradually adding features that will help you achieve the same results as an API would. If there is something in particular that you would like, requesting it will help us give it a higher development priority.
1. Linking to new requests
To encourage your users to make requests to a particular public authority, use URLs of the form: https://www.whatdotheyknow.com/new/liverpool_city_council. As explained in this blog post in detail, there are several parameters you can add to those URLs, either in the URL or from a form:
- title - default summary of the new request.
- default_letter - default text of the body of the letter. The salutation (Dear...) and signoff (Yours...) are wrapped round this.
- body - as an alternative to default_letter, this sets the default entire text of the request, so you can customise the salutation and signoff.
- tags - space separated list of tags, so you can find and link up any requests made later, e.g. openlylocal spending_id:12345. The : indicates it is a machine tag. The values of machine tags may also include colons, useful for URIs.
2. RSS (actually, Atom) feeds
There are Atom feeds on most pages which list FOI requests, which you can use to get updates and links in XML format. Find the URL of the Atom feed in one of these ways:
- Look for the RSS feed links.
- Examine the <link rel="alternate" type="application/atom+xml"> tag in the head of the HTML.
- Add /feed to the start of another URL.
Even complicated search queries have Atom feeds. You can do all sorts of things with them, such as query by authority, by file type, by date range, or by status. See the advanced search tips for details.
3. JSON structured data
Quite a few pages have JSON versions, which let you download information about objects in a structured form. Find them by:
- Adding .json to the end of the URL.
- Look for the <link rel="alternate" type="application/json"> tag in the head of the HTML.
Requests, users and authorities all have JSON versions containing basic information about them. Every Atom feed has a JSON equivalent, containing information about the list of events in the feed.
4. Spreadsheet of all authorities
A spreadsheet file listing every body in WhatDoTheyKnow is available: all-authorities.csv
5. Write API
The write API is designed to be used by authorities to create their own requests in the system. The API was used by mySociety’s FOI Register software to support using Alaveteli as a disclosure log for all FOI activity at a particular public body. More technical information about the write API is available on the Alaveteli.org site.
Please contact us if you need a feature that we don’t currently provide.