Budget per country per year pie chart

I’d like to use the openspending api to allow users to view pie-charts for county budgets for a given year, allowing them to drilldown by clicking on the relevant pie slice for sub-categories.

Similar to what is shown here but then using a pie-chart by explicit calls to the API:

Which API calls to I have to use to get all the budget items per year as well as the sub-categories of these items?

Thanks very much in advance!