Go Back Developer area

A close-up of some nuts.

The DataShare API

The DataShare API provides access to all the datasets stored in DataShare. The API implements RESTful interfaces to allow developers to perform simple queries on the available data. XML and JSON representations of the data are available.

Getting started

The DataShare API lets you programmatically access tens of thousands of records and query the data in several ways, using the url and additional parameters to specify the data you would like returned.


Some simple API requests

Details of all categories

Search for all available data categories, their descriptions and the URL stubs needed to access them.

http://data.redbridge.gov.uk/api/The DataShare domain followed by /api/

Example: http://data.redbridge.gov.uk/api returns a list of all available data categories.

Schema details

Search for all available datasets within a category, their descriptions and the URL stubs needed to access them.

http://data.redbridge.gov.uk/api/The DataShare domain followed by /api/Category/The category to be queried.

Example: http://data.redbridge.gov.uk/api/finance returns a list of all datasets in the Finance category.

Uploaded data files

Details of the data files uploaded to a dataset.

http://data.redbridge.gov.uk/api/The DataShare domain followed by /api/Category/The category that the dataset is in.SchemaName/The dataset to be queried.

Example: http://data.redbridge.gov.uk/api/finance/payments-over-500 would return a list of all uploaded datasets for Payments over £500 in the Finance category.

Dataset definition

The definition of a dataset, including column names, types, etc.

http://data.redbridge.gov.uk/api/The DataShare domain followed by /api/Category/The category that the dataset is in.SchemaName/The dataset to be queried followed by the definition request.definition

Example: http://data.redbridge.gov.uk/api/finance/payments-over-500/definition would return a list of all the columns in the Payments over £500 dataset in the Finance category.


A simple API request with a filter added

All of the data in a dataset that contain a keyword(s) in one field can be returned by specifying a schema URL (as above) and adding the following:

SearchTypeThe type of search to perform (see below for the full list).?fieldToSearch=FieldToSearchThe field to perform the search on.&searchText=SearchTextThe text to search for (This should be HTML encoded).&format=ReturnFormatThe format to return the data in (options are XML or JSON).

Example: ../SearchByTextContains?fieldToSearch=AccountDescription&searchText=Miscellaneous&format=xml would return all data for Payments over £500 in the Finance category paid to miscellaneous.


Search types

SearchByTextEquals

Search for entries in the field <fieldToSearch> that exactly match the word (or words) <searchText>.

Parameters:

  • fieldToSearch
  • searchText
  • format

Example: ../SearchByTextEquals?fieldToSearch=AccountDescription&searchText=Miscellaneous&format=xml


SearchByTextContains

Search for entries in the field <fieldToSearch> that contain the word (or words) <searchText>.

Parameters:

  • fieldToSearch
  • searchText
  • format

Example: ../SearchByTextContains?fieldToSearch=AccountDescription&searchText=Misc&format=xml


SearchByNumberEquals

Search for entries in field <fieldToSearch> that are exactly equal to <searchText>.

Parameters:

  • fieldToSearch
  • searchText
  • format

Example: ../SearchByNumberEquals?fieldToSearch=Amount&searchText=1480&format=xml


SearchByNumberGreaterThan

Search for entries in field <fieldToSearch> that are greater than <searchText>.

Parameters:

  • fieldToSearch
  • searchText
  • format

Example: ../SearchByNumberGreaterThan?fieldToSearch=Amount&searchText=1480&format=xml


SearchByNumberGreaterThanEqualTo

Search for entries in field <fieldToSearch> that are greater than or equal to <searchText>.

Parameters:

  • fieldToSearch
  • searchText
  • format

Example: ../SearchByNumberGreaterThanEqualTo?fieldToSearch=Amount&searchText=1480&format=xml


SearchByNumberLessThan

Search for entries in field <fieldToSearch> that are less than <searchText>.

Parameters:

  • fieldToSearch
  • searchText
  • format

Example: ../SearchByNumberLessThan?fieldToSearch=Amount&searchText=1480&format=xml


SearchByNumberLessThanEqualTo

Search for entries in field <fieldToSearch> that are less than or equal to <searchText>.

Parameters:

  • fieldToSearch
  • searchText
  • format

Example: ../SearchByNumberLessThanEqualTo?fieldToSearch=Amount&searchText=1480&format=xml


SearchSchemaDate

Search for entries in field <fieldToSearch> that are between <from> and <to>.

Parameters:

  • fieldToSearch
  • from (DD-MM-YYYY)
  • to (DD-MM-YYYY)
  • format

Example: ../SearchSchemaDate?fieldToSearch=TransactionDate&from=29112005&to=11102006&format=xml


API request for a particular dataset file that was uploaded

A list of all the files that have been uploaded for a dataset can be returned as follows:

http://data.redbridge.gov.uk/api/The DataShare domain followed by /api/Category/The category that the dataset is in.SchemaName/The dataset to be queried.Dataset/The dataset file to show.?format=ReturnFormatThe format to return the data in (options are XML or JSON).

Example: http://data.redbridge.gov.uk/api/finance/payments-over-500/january-2011 would return all data for Janurary 2011 file uploaded to Payments over £500 in the Finance category.

Restrictions

There is a currently a limit on requests of 10,000 returned results. If you need to return more results than this please get in touch with us.


URL search

The following are examples of how to open a dataset's view page with a pre-defined search:

Example search by text field:
?filter[0].ColumnToSearch=Directorate&filter[0].SearchOperator=contains&filter[0].SearchText=LEA

Example search by number field:
?filter[0].ColumnToSearch=Amount&filter[0].SearchOperatorNumber=greaterthan&filter[0].SearchNumber=100000

Example search by date:
?filter[0].ColumnToSearch=TransactionDate&filter[0].SearchOperatorDate=greaterthan&filter[0].From=01/01/2010&filter[0].To=31/01/2010

Bugs and feature requests

We're always trying to make DataShare better. So, if you spot any bugs or have any feedback, stories of how you're using DataShare, or feature requests please let us know via our contact page.