[wdmmg-discuss] First stab at a web API

Alistair Turnbull apt1002 at goose.minworks.co.uk
Thu Mar 18 17:17:48 UTC 2010


As of a few minutes ago, the following request returns the CRA data set, 
broken down by department and region, but summed over everything else:

 	http://store.wheredoesmymoneygo.org/api/aggregate?slice=cra&breakdown_key1=region&breakdown_key2=dept

The data is returned in the form of a pivot table, represented in JSON. 
For details, have a look at the output.

You may notice that all the amounts are negative. This is a bug.

The other possible breakdown keys are:

 	pog (Program Object Group)
 	function (COFOG "function")
 	subfunction (COFOG "subfunction")

If you break down by subfunction, you probably want to break down by 
function too. We intend to let users add their own breakdown keys (e.g. 
William Wates has regularised the COFOG codes), but for the moment you're 
stuck with these five keys.

There are other request parameters too, though they are not very useful 
yet. They are as follows:

  - slice - In future we expect to provide access to other data sets by 
changing the "slice" parameter (which is set to "cra" above). We also 
intend to let users upload and publish their own slices.

  - spender_key, spender_value - In more structured data sets such as 
COINS, it will be necessary to be more pedantic about exactly which set of 
accounts are to be regarded as the "spender" for the purpose of the 
report. This will be achieved using these parameters. In the CRA there is 
no ambiguity so these parameters are not needed.

  - start_date, end_date - You can restrict the date range of interest by 
supplying dates in the format YYYY-MM-DD. If omitted, all years' data is 
summed. (Not fully tested yet, but might work).

In summary, this is an early stab at our main web API call. Comments 
welcome.

 	Alistair




More information about the openspending mailing list