List locations
Endpoint
Section titled “Endpoint”GET /api/locationsReturns Australian locations, including suburbs, postcodes, and states. The response is paginated due to the large number of locations.
Pagination
Section titled “Pagination”To retrieve a specific page of results, use:
GET /api/locations/page/{page}| Parameter | Type | Required | Description |
|---|---|---|---|
page | integer | No | Page number (starts at 1). Default page size is 1000. |
limit | integer | No | Optional page size query parameter (default 1000). |
Request
Section titled “Request”# Get the first page of locationscurl -X GET \ -H "Content-Type: application/json" \ https://www.transdirect.com.au/api/locations
# Get a specific pagecurl -X GET \ -H "Content-Type: application/json" \ https://www.transdirect.com.au/api/locations/page/5Response
Section titled “Response”A successful response returns a 200 status code with an envelope, not a bare array:
{ "code": 200, "locations": [ { "id": 1, "locality": "SYDNEY", "postcode": "2000", "state": "NSW", "priority": 1 }, { "id": 2, "locality": "THE ROCKS", "postcode": "2000", "state": "NSW", "priority": 2 } ], "next_page": "https://www.transdirect.com.au/api/locations/page/2"}When a previous page exists, a prev_page absolute URL is also included.
Response fields
Section titled “Response fields”| Field | Type | Description |
|---|---|---|
code | integer | HTTP-style status code in the body (200) |
locations | array | Location rows for this page |
next_page | string | Absolute URL of the next page (only when a full page of results was returned) |
prev_page | string | Absolute URL of the previous page (only when page > 1) |
Location object
Section titled “Location object”| Field | Type | Description |
|---|---|---|
id | integer | Suburb row id |
locality | string | Suburb or locality name |
postcode | string | Four-digit Australian postcode |
state | string | State or territory abbreviation |
priority | integer | Sort priority within the postcode |