Skip to content
  • Home
  • Blog
  • Connect the dots - using the government A to Z API for data.govt.nz

data.govt.nz

Connect the dots - using the government A to Z API for data.govt.nz

Connect the dots mazeOk, so I'm in the middle of data migration for the new data.govt.nz open data portal at the moment and thought I'd take a moment to highlight something that: 

  1. saved me a lot of time 

  1. means you can replicate my work in your own data portal 

  1. you could use for populating consistent data in your own digital services 

  1. is geeky as (and we like it that way) 

Picture this... I have to go and setup the new CKAN powered data portal and list every government organisation that is publishing released data on data.govt.nz. I could copy and paste each one... however this doesn't make it reusable or easy to replicate. CKAN has a great API, and as I discovered, so does Govt.nz. 

Time to connect the dots. 

Govt.nz A to Z has a list of the names, descriptions and head office contact details for government organisations. It also makes this data available via a JSON API endpoint. There is documentation, as well as an api tool to explore the data and help you make the best use of the API. 

A small portion of code and presto, I was able to pull the data needed, convert it into the JSON Linked Data metadata schema standard that CKAN likes to ingest. I then made use of the CKAN API command line tool to push the data into place in our staging site. Much faster that doing data entry manually. 

This means I now have all the organisation data I need in data.govt.nz, all with a consistent description and all powered by a reusable and centrally maintained data API. 

A sprinkle of code beats a copy and paste job any day. 

I could see the A to Z API being used for handy things such as populating dropdown form fields anytime a government agency needs to be specified in a form or connecting with other datasets to ensure consistent naming of agencies. 

The more APIs we have available as component parts to work with the better - the future of digital services is in reusable data and APIs fueling government digital services and generally providing a better experience for the end user. 

I did find that there could be some improvements to the Govt.nz A to Z API.

Here's my wish list: 

  • Logo (say in png or jpg format) - I wasn't able to put everyone's shiny logo on their new data.govt.nz organisation page (agencies however will be able to update this themselves in due course once we are live). 

  • Contact details weren't available via API as it would have been nice to supply general email/phone to data users to engage with an agency if they need to. 

  • The organisation name in Te Reo. 

I'll look to see what we can do about these in the future.

Going forward, I'll be looking at what else we can automate and carry out using machine readable formats, APIs etc on data.govt.nz as we head towards the launch of the new data portal

Next blog post, I'll be discussing the adoption of a new metadata schema (well, not new, it's an international standard for wrangling open data metadata) for our automated dataset harvesting that agencies can look to adopt to help automate getting their datasets into data.govt.nz.