We’ve been reviewing how we deliver data. We are moving static or infrequently updated files from being delivered as an api.transport.nsw.gov.au to a downloadable dataset. You will still be able to get the file programmatically via the Open Data portal API.
Facilities and Operators will be the first file to move across.
What does that mean to me?
Transport for NSW will no longer be updating the file returned from the endpoint:
You will need to use the Open Data portal API (dataset API) to retrieve the file.
How do I use the Open Data portal API?
To download a file you need three pieces of information
- an authorization key,
- the UUID of the file you want to download and
- the download endpoint.
The authorization key is just your portal credentials base64 encoded. You can create your key in your code or by using an online encoder. If using the online encoder, enter your username and password separated by a colon. i.e Username:Password .
The file UUID is found in the additional information section on the resource page.
The download endpoint is:
Example call in curl:
curl -H “Authorization: Basic [Your Key Here]” https://opendata.transport.nsw.gov.au/api/download/[File UUID Here]
To download “location facilities” the command would look like:
curl -H “Authorization: Basic bm90bXk6cmVhbHBhc3N3b3JkOi” https://opendata.transport.nsw.gov.au/api/download/ca137e89-b274-428c-988c-1f56be759260