Spend Network API
First published: 18th February 2014
The Spend Network database contains records of transactions (that is spending) between UK public sector organisations and their suppliers. The primary fields in each transaction record describe: a) transaction date, b) buyer, c) supplier, and d) amount spent.
In its current version, the Spend Network API enables developers to list and to view transactions for a single buyer. There is also a “discovery” resource which returns a list of the UK buyers for which Spend Network currently holds transactions.
VIEWING THE API
The API data can be browsed in HTML format or in JSON format. When viewed in HTML format it becomes simple to browse and to explore the structure of the data. The data contains hyperlinks that can be used to page through large sets of records. To see an example, load the following page in a web browser:
To see any API resource in JSON format, simply append “?format=json” to the URL. As an example, the above URL is converted to JSON in the following line.
RESOURCE 1 : RETRIEVE A LIST OF BUYERS
This provides a list of records, each of which has 3 fields which are described below:
ENTITY_ID: Spend Network’s identifier of a buyer. e.g: DCM048_DFCMAS_gov
ENTITY_NAME: Buyer Name. e.g. DEPARTMENT FOR CULTURE, MEDIA AND SPORT
TRANSACTIONS: This is a link to the API page that gives the transactions for this buyer. e.g. http://www.spendnetwork.com/api/spend/entity/DCM048_DFCMAS_gov/
RESOURCE 2: RETRIEVE TRANSACTIONS FOR A SELECTED BUYER
It is necessary to append the ENTITY_ID. ENTITY_ID can be discovered by using RESOURCE 1 (as in the previous section).
This resource provides a list of records, each of which has five fields which are described below.
TRANS_ID: Spend Network’s unique ID for this transaction. E.g. DCM048_DFCMAS_gov_2011_04_36
AMOUNT_EXECUTED: The value of the published transaction.
SUPPLIER_SOURCE_STRING: The name of the supplier published in the spend statement.
DATE_COMPLETED: The published date string.
FULL_DETAILS: This is a hyperlink to the ‘detail’ record for this transaction. An example is: http://www.spendnetwork.com/api/spend/detail/DCM048_DFCMAS_gov_2011_04_36/
RESOURCE 3: RETRIEVE A SINGLE TRANSACTION RECORD IN DETAIL
The URL to access this resource is given below. It is necessary to append the TRANS_ID key for the record required. Obtaining a TRANS_ID is described in detail in the section describing RESOURCE 2.
This resource returns a record comprising key value pairs. The record comprises all of the data made available by in the raw data that is uploaded in the Spend Network database.
An example record can be seen by opening the following page: http://www.spendnetwork.com/api/spend/detail/DEC066_DOEACC_gov_2011_04_102
Originally published at spendnetwork.github.io.