A few years ago I published the nzcoapi gem which was primarily a wrapper for ‘difficult to navigate’ SOAP API provided by the New Zealand Companies Office.
The API has been grandfathered and a flash new NZBN API is available which is a lot cleaner and easy to use. I had to update a number of applications and have now released an updated Ruby Gem which makes interacting with the new NZBN API a breeze.
- Refer to Github: nzbn Gem
Simple and fast authenticating API wrapper for the New Zealand Companies Office. Full functionality to search by company name, company number and director.
Installation
Add this line to your application’s Gemfile:
And then execute:
$ bundle
Or install it yourself as:
$ gem install nzbn
You will also need to set the following ENV variables in order to access the API. These can be found on the business.govt.nz website under your login.
$ NZBN_ID=
$ NZBN_SECRET=
Usage
Two functions have been exposed, as per below.
Company details by NZBN
Full company details based on a unique ‘Company Number’ (nzbn) will be returned.
Search for a Company
All output is returned as parsed JSON. Within a rails view it can be quickly navigated with Nokogiri or similar.