v1
latestOpenAPI 3.0.12026-07-133126.1 KBView metadata associated with a single record.
If you know its record_id you can use this endpoint to view all metadata associated with that specific record.
Path parameters
Every record has a unique, persistent record_id.
Note - There is a small difference with some field names in the response between JSON and XML.
When a field name has more than one word, JSON format will separate the words with an underscore, eg. "content_partner", whereas XML uses a hyphenated naming convention, eg. "content-partner".
Query parameters
Comma-separated whitelist of fields to be returned. The syntax "&fields=verbose" can be used to return the bulk of the fields, or you can customise which fields you are interested in, eg. "&fields=id,title,subject,collection,landing_url,locations".
Headers
The DigitalNZ API no longer requires a key to access public content. However, if you plan on using the API regularly, expect to be a high volume consumer or are planning on creating an application, we encourage you to use an API key so that we can:
- provide targeted help and support
- increase your query throughput (by negotiation)
- notify you directly of changes to the API
- gather usage metrics to help improve the service
API requests that do not pass a valid API key/token are treated as unauthenticated. A maximum rate limit applies across all unauthenticated requests. This rate limit is in place to protect the service from overuse, resulting in unsustainable costs, or potential attack.
Getting an API key
Create a DigitalNZ account, log in and select "my API key" from your username drop-down menu (on the right hand side)'. The key is a long string of jumbled letters and numbers (hash) that is unique to you. You are required to keep the key secret. (Refer to the Developer API Terms of Use for more information).
Using an API key
When you make a call to the API you'll need to pass the key in a custom HTTP header: ‘Authentication-Token’.
For example, a query using the ‘curl’ command might look like the following (where ‘{YOUR_API_KEY}’ is replaced with a valid API key):
curl -H "Authentication-Token:{YOUR_API_KEY}" http://api.digitalnz.org/v3/records.json?text=kiwi
Response
ok
Example response
{
"id": 1788754,
"created_at": "2012-04-21T05:32:02.000+13:00",
"updated_at": "2020-12-06T01:36:37.359+13:00",
"title": "Election night crowd, Wellington, 1931",
"display_date": "Circa 1996",
"source_url": "https://api.digitalnz.org/records/1788754/source",
"locations": [
{
"lat": -37.508219086,
"lng": 177.1802173,
"placename": "White Island",
"comment": "Location provided by the Alexander Turnbull Library"
}
]
}