Skip to content

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/.

The following XML metadata standards are supported:

  • ISO 19115/19139
  • FGDC CSDGM (layers and tables only)
  • Dublin Core
GET…/metadata/Get XML metadata

Returns 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/xml

Body

<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>
POST…/metadata/Set or replace metadata

If 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/xml

Body

<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/json

Body

{
"url": "https://{domain}/services/api/v1.x/layers/123/versions/456/metadata/",
"url_html": "/layer/123-harbour-imagery/metadata/"
}
PUT…/metadata/{type}/Edit metadata

This is an advanced API to facilitate XML metadata editing via element changes, and is not documented here.

GET…/metadata/{type}/Get XML metadata by type

Returns 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/xml

Body

<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>
GET…/metadata/simple/Get simplified metadata
GET…/metadata/{type}/simple/Get simplified metadata by type

Returns 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.

GET…/metadata/{type}/elementDefinition/Get metadata element definition

This is an advanced API to facilitate XML metadata editing via element changes, and is not documented here.

GET…/metadata/{type}/context/Get metadata editing context

This is an advanced API to facilitate XML metadata editing via element changes, and is not documented here. (Note that type is optional).