Availability: Available since version 1
History: Query parameters and response formats significantly changed in version 3. Versions 1 and 2 are no longer supported.
The Search Records API call returns a result set in response to a search query.
Request parameters, required
The following must be specified as request parameters:
- text - the text you wish to search for
- api_key - the developer API key. In the example URLs replace
<your_api_key> with your personal API key
Request parameters, optional
The following may be specified as request parameters:
- and - Restricts search to records matching all facet values. Example:
- or - Restricts search to records matching any of the specified facet values. Example:
- without - Restricts search to records that don't match any of the facet values. Example:
- per_page - The number of records to return per page of search results. Maximum of 100. Defaults to 20.
- page - Which page of results to return. Defaults to 1.
- facets - A list of facet fields to include in the output. See the note on facets below for more information. Example:
- facets_per_page - The number of facets to return per page of facets fields. Defaults to 10.
- facets_page - Which page of facet fileds to return. Defaults to 1.
- sort - The field upon which results are sorted. Defaults to relevance sorting. The sort field must be either
- direction - The order in which the results are sorted. Possible values:
asc (ascending) or
- geo_bbox - A geographic bounding box scoping a search to a geographic region. Order of latitude-longitude coordinates is north, west, south, east. The following example searches the Wellington region:
In version 3 the search records and get metadata call response elements have been standardised. Appending an extension to a resource tells the API to use the requested format. Valid extensions are:
Note: Responses in XML format will return field names in a hyphenated format. For example; "content_partner" in an XML format will look like:
The search results will return the following elements:
- num_results_requested - value of the num_results parameter sent in the request.
- result_count - total number of matching search results.
- start - value of the start parameter sent in the request.
- results - search result records
The results element will contain 0 or more result elements, each containing the following elements:
- is_commercial_use - whether or not this record is licensed for commercial use
- category - comma-separated list of categories applied to this record (e.g. Images, Web pages)
- content_partner - institution holding the content to which this record refers
- date - date associated with this record (e.g. 1996-01-01T00:00:00.000Z). This field may be empty.
- description - text describing this record
- additional_description - additional text describing this record
- landing_url - URL for the content on the content partner's website.
NB: Please use the source_url (see below) when providing HTML links.
- id - internal DigitalNZ identifier (used by the Get Metadata API call)
- source_url - URL that will redirect users to the landing_url.
NB: Please provide this URL (as opposed to the landing_url) in public hyperlinks so that we are able to count click-throughs, which is helpful for demonstrating
the value of DigitalNZ, thus helping us to continue our service.
- syndication_date - date this record was added to DigitalNZ
- thumbnail_url - URL for a thumbnail image of the content to which this record refers. This field may be empty.
- title - title of this record
- geo_co_ords - latitude and longitude in the following format: namespace:lat,long;
Multiple values are separated by semi-colons. For example: namespace:lat,long;namespace:lat,long;namespace:lat,long;
NOTE: namespace is
- large_thumbnail_url - a larger thumbnail image with dimensions up to 800px (NB the API Terms do not extend rights to the use of these thumbnails)
- copyright - copyright statement applying to the object referenced by this record. This field may be empty.
- license - licence for the object referenced by this record. This field may be empty.
- rights_url - URL of the object licence. This field may be empty.
- display_date - date information in various, often unstructured, formats (e.g. Circa 2000)
- peer_reviewed - boolean, associated with research paper items. True indicates the research paper has been peer reviewed
- marsden_code - number indicating the field of research
- author - lists the author's names
- no_landing_page - boolean value, if set to true it indicates the item doesn't have an external landing page, usually because it is a downloadable item such as a pdf or mpeg
- object_url - a url pointing to a downloadable object, i.e. an image, pdf or mpeg
- published_date - list of dates published
- publisher - lists the publisher's names
- dctype - Dublin Core categorisation indicating type
- library_collection - the library collection the item belongs to
- display_collection - the display collection the item belongs to
- collection_parent - the item's parent collection
- collection_root - the top level collection
- the facet result data (if requested). The facets element will contain one facet-field element corresponding to each facet requested. Each facet-field element contains a sorted list of value elements that are made up of a name and num-results
element. See the note below for more information on facets.
Faceted search is a user interface technique for helping users to refine their searches by prompting them with metadata elements to add to their search. The Wikipedia faceted search page provides
useful background information.
DigitalNZ can calculate facet values for any search. In the DigitalNZ search interface these facets are used to filter and categorise search results.
The facets that you can request through the DigitalNZ search records API are category, display_collection, creator, placename, year, decade, century,
language, content_partner, rights, collection.
Some DigitalNZ partners offer their metadata for use in commercial applications. This content can be identified through the is_commercial_use flag. Only API results where the is_commercial_use field set to True can be used for commercial
For example, to search for results relating to Auckland that are available for commercial use you would use this query:
Search for 'social welfare' and return only ten results per page, starting at page three:
Search for 'social welfare' and only return the title, content_partner, creator and display_collection fields:
Search for Kete Horowhenua for images with the term 'hangi':
Give me result counts for the search term 'health' broken down by top 20 content partners, without showing me the actual records:
Search for Wellington region for the term "kiwi":