Requests
The Changeset API leverages the LDS Web Feature Service. The default version for this service is WFS 2.0. The API supports WFS HTTP GET requests including the following operations:
- GetCapabilities: returns metadata and valid WFS operations and parameters about the changeset.
- GetFeature: returns features from the changeset.
The URL request parameters for the Changeset API and the standard LDS WFS differ in 2 ways:
- The layer identifier is appended with the parameter '–changeset', for example 'table-52067-changeset' or 'layer-50804-changeset'
- Additional 'from' and 'to' timestamp parameters are required to specify the range of time to return changes between.
You can also apply standard WFS filtering operations to your request if you want to return changeset data for a specific locality or for specific attributes.
GetCapabilities request
The base GetCapabilities URL for the Changeset API has the following variables:
https://data.linz.govt.nz/services;key=YOUR_API_KEY/wfs/layer-LAYER_ID-changeset?SERVICE=WFS&VERSION=VERSION_NUMBER&REQUEST=GetCapabilities&viewparams=from:TIMESTAMP;to:TIMESTAMP
- YOUR_API_KEY – your LDS API key
- LAYER_ID – the identifier of the LDS dataset
- VERSION_NUMBER – the WFS version
- TIMESTAMP – the time range to return changes between.
For aspatial tables, the ‘layer-LAYER_ID-changeset’ parameter is replaced by ‘table-TABLE_ID-changeset'.
GetFeature request
The GetFeature URL for the Changeset API has the same variables:
https://data.linz.govt.nz/services;key=YOUR_API_KEY/wfs?SERVICE=WFS&VERSION=VERSION_NUMBER&REQUEST=GetFeature&typeNames=layer-LAYER_ID-changeset&viewparams=from:TIMESTAMP;to:TIMESTAMP
Changeset API GetFeature request example
This example makes a WFS 2.0.0 GetFeature request for the NZ Property Titles layer change-set between 15 August 2018 and 25 August 2018, limited to 4 features and output as a CSV file:
https://data.linz.govt.nz/services;key=YOUR_API_KEY/wfs?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&typeName=layer-50804-changeset&viewparams=from:2018-08-15;to:2018-08-25&count=4&outputformat=csv
Output format
When requested through the changeset generator on LDS, your changeset is requested using a WFS GetFeature URL with CSV specified as the output format. Other output formats are listed in the table below.
Format | URL parameter syntax | Notes |
---|---|---|
GML2 | &outputFormat=GML2 | Default for WFS 1.0.0 |
GML3 | &outputFormat=GML3 | Default for WFS 1.1.0 and WFS 2.0 |
JSON | &outputFormat=json | |
CSV | &outputFormat=csv | Geometry in WKT format |
KML | &outputFormat=kml |
See our guide on how to use the Changeset generator for more options for accessing changeset data.