Datasets available through the Shared Location Information Platform (SLIP) are uploaded via the Data Upload Tool (DUT). DUT has its own Application Programming Interface (API):
You can use this API to get a dataset's upload information, as well as dataset statistics.
Help: How do you know if a dataset is in SLIP? Check if it has a dataset identifier next to the title.
What can you do with the DUT API?
The Data WA team currently use the DUT API to automatically update the Data last updated field in data.wa.gov.au for SLIP datasets. This was achieved using an FME workbench with the DUT API, the CKAN API and Task Scheduler.
Some of our frequent data users are using the DUT API to make their scripting more efficient and reliable, for example:
- Only updating their local copies of data when something has changed.
- Detecting and alerting them when something that should update hasn't (e.g. an unexpected failure in the daily cadastral updates).
Check out this example of a simple FME workbench.
Warning: The DUT API last successful upload date does not apply to data downloads. It only applies to services, e.g. Web Map Service, ArcGIS Server Feature Service, etc. Data downloads are generated by a different process. You can find the Last updated date for a download by going to data.wa.gov.au, clicking on the download, and scrolling down to Additional Information.
Using the DUT API
To use the API you will need the dataset identifier. This is the short code made up of letters and numbers beside the dataset title in data.wa.gov.au.
Info: The DUT API is currently an open API that requires no authentication or API Key.
The API can be called with an HTTP GET request. For example, paste this URL into your browser:
Info: An HTTP GET request is an HTTP command used to request a file from a web server.
The id parameter is where you enter the dataset identifier to get the upload information for that dataset. If the dataset identifier doesn’t exist, you’ll get a 404 error. Note that the dataset identifier is not case sensitive.
Dates will be displayed in ISO datetime format, i.e. YYYY-MM-DD T(for time) hh:mm:ss followed by decimal fractions of a second. The time displayed is Australian Western Standard Time (UTC+8), regardless of your local timezone.
The information returned by the API call is:
- SlipCode - the dataset identifier.
- Title - the human-readable title of the dataset.
- FeatureClassName - the name of the file that the data custodian uploaded.
- LastSuccessfulUpload - the data and time of the last successful data upload.
- DatumOfLastSuccessfulUpload - the datum the data was uploaded in, prior to any transformations to align with the SLIP database.
- LastSuccessfulUploadHasZValues - whether or not the data contains a height value.
- OriginalGoLiveDateTime - the data and time that the dataset was first published via SLIP.
Tip: Don't confuse last successful upload for new data added. There are many reasons for data custodians to re-upload a dataset, from additional data to minor error corrections. For efficiency and consistency, many data custodians have scheduled uploads that run whether or not the data has changed at all.
You can also get DUT dataset statistics using an API call:
The statistics returned by the API call are:
- DatasetCountByApplicationStage - the number of datasets at each DUT application stage.
- AgencyGroupNames - a list of all data custodian agency groups.
- ActiveDatasetsByAgencyGroup - the number of active datasets per agency group.
- ActiveDatasetNamesByAgencyGroup - lists of active datasets for each agency group.
Requests HTTP library for Python
If you use the Python package Requests, try out this code:
>>> import requests
>>> r = requests.get('https://selfservice.slip.wa.gov.au/api/index?id=WAM-002')
If you’re not yet using Requests, you can download it for free at https://pypi.org/project/requests/.
“Requests is an elegant and simple HTTP library for Python, built for human beings.
Requests allows you to send HTTP/1.1 requests extremely easily. There’s no need to manually add query strings to your URLs, or to form-encode your POST data. Keep-alive and HTTP connection pooling are 100% automatic, thanks to urllib3.”
Feedback and suggestions
Got an idea for improving the API? Noticed an error in this article? Have a story to share about your adventures in automation? Get in touch with us via email@example.com!