Search locations
Endpoint
Section titled “Endpoint”GET /api/locations/searchSearches for Australian locations matching a query string. You can search by suburb name, postcode, or a combination of both.
Query parameters
Section titled “Query parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
q | string | Yes | Search query (suburb name, postcode, or partial match) |
Request
Section titled “Request”# Search by suburb namecurl -X GET \ -H "Content-Type: application/json" \ "https://www.transdirect.com.au/api/locations/search?q=melbourne"
# Search by postcodecurl -X GET \ -H "Content-Type: application/json" \ "https://www.transdirect.com.au/api/locations/search?q=3000"Response
Section titled “Response”A successful response returns a 200 status code with an array of matching location objects.
[ { "locality": "MELBOURNE", "postcode": "3000", "state": "VIC" }, { "locality": "MELBOURNE AIRPORT", "postcode": "3045", "state": "VIC" }, { "locality": "EAST MELBOURNE", "postcode": "3002", "state": "VIC" }, { "locality": "NORTH MELBOURNE", "postcode": "3051", "state": "VIC" }, { "locality": "SOUTH MELBOURNE", "postcode": "3205", "state": "VIC" }, { "locality": "WEST MELBOURNE", "postcode": "3003", "state": "VIC" }]Response fields
Section titled “Response fields”| Field | Type | Description |
|---|---|---|
locality | string | Suburb or locality name |
postcode | string | Four-digit Australian postcode |
state | string | State or territory abbreviation (e.g. NSW, VIC, QLD, SA, WA, TAS, NT, ACT) |