Metadata API
The Metadata API provides an interface for adding, inspecting, and downloading XML metadata documents against a range of objects.
The metadata API is a sub-API of data object details pages. This means that the URL will vary according to each data object. Specifically:
- Sources at
/sources/{source-id}/metadata/ - Layers at
/layers/{layer-id}/versions/{version-id}/metadata/ - Tables at
/tables/{table-id}/versions/{version-id}/metadata/ - Documents at
/documents/{document-id}/versions/{version-id}/metadata/ - Sets at
/sets/{set-id}/versions/{version-id}/metadata/
The endpoints below are relative to these URLs, shown as …/metadata/.
Supported metadata standards
Section titled “Supported metadata standards”The following XML metadata standards are supported:
- ISO 19115/19139
- FGDC CSDGM (layers and tables only)
- Dublin Core
Metadata detail
Section titled “Metadata detail”…/metadata/Get XML metadataReturns the XML metadata for this object, in its native format. Returns 404 if the object has no metadata. Add ?format=json for a JSON rendering, or ?format=pdf for a PDF. Add ?dl to get a Content-Disposition header so that it downloads as a file.
Response 200
Headers
Content-Type: text/xmlBody
<dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"> <title>Auckland Harbour Imagery (4m)</title> <creator>Bob Jones and Associates</creator> <subject>hydro</subject> <description>Some nice colourful aerial photos of the Auckland Harbour.</description> <date>2013-01-01</date> <type>raster</type> <language>eng</language></dc>…/metadata/Set or replace metadataIf the object already has XML metadata, it will be overwritten. This will accept XML metadata in any of the supported formats. The format will be detected from the XML content. Layer and table versions can only be changed while they’re a draft.
Send the XML as the body with Content-Type: text/xml (or application/xml). You can also send JSON with the XML in a metadata property, or with a url property to fetch the XML from an http, https or ftp URL, or a multipart request with a metadata file. A body that isn’t valid metadata returns 400 with No valid ISO 19115, FGDC or Dublin Core XML metadata found.
Request
Headers
Content-Type: text/xmlBody
<dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"> <title>Auckland Harbour Imagery (4m)</title> <creator>Bob Jones and Associates</creator> <subject>hydro</subject> <description>Some nice colourful aerial photos of the Auckland Harbour.</description> <date>2013-01-01</date> <type>raster</type> <language>eng</language></dc>Response 200
Headers
Content-Type: application/jsonBody
{ "url": "https://{domain}/services/api/v1.x/layers/123/versions/456/metadata/", "url_html": "/layer/123-harbour-imagery/metadata/"}…/metadata/{type}/Edit metadataThis is an advanced API to facilitate XML metadata editing via element changes, and is not documented here.
Metadata types
Section titled “Metadata types”…/metadata/{type}/Get XML metadata by typeReturns the XML metadata for this object, converted to a different format. The converted metadata may not contain all the same information as the native format. Returns 404 if that format isn’t available for this object’s metadata.
Parameters
type: string (required)
choices: iso fgdc dc
Response 200
Headers
Content-Type: text/xmlBody
<dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"> <title>Auckland Harbour Imagery (4m)</title> <creator>Bob Jones and Associates</creator> <subject>hydro</subject> <description>Some nice colourful aerial photos of the Auckland Harbour.</description> <date>2013-01-01</date> <type>raster</type> <language>eng</language></dc>Simplified metadata
Section titled “Simplified metadata”…/metadata/simple/Get simplified metadata…/metadata/{type}/simple/Get simplified metadata by typeReturns a simplified JSON representation of the metadata: a list of elements, where each element has a name list and either a list of children elements or a list of string values.
Metadata element definition
Section titled “Metadata element definition”…/metadata/{type}/elementDefinition/Get metadata element definitionThis is an advanced API to facilitate XML metadata editing via element changes, and is not documented here.
Metadata editing context
Section titled “Metadata editing context”…/metadata/{type}/context/Get metadata editing contextThis is an advanced API to facilitate XML metadata editing via element changes, and is not documented here. (Note that type is optional).