LOGBOOK

HELP

Quiz Entry - updated: 2026.07.14

How does the Open Transport API /locations endpoint work, and what does it return?

/locations takes a search term (or coordinates) and returns matching locations — stations, addresses, points of interest — each scored by how well it matches.

This is the search step: the user types "Basel", you call /locations, and you get back candidates to choose from.

http://transport.opendata.ch/v1/locations?query=Basel
Parameter Required Meaning
query one of query or x+y text to search for (e.g. Basel)
x, y one of query or x+y latitude/longitude to search near
type optional (only with query) filter results: all (default), station, poi, address

The response is a stations array; each entry carries an id, a name, a score (higher = better match), and coordinates. The score matters because the top hit isn't always what the user meant — you usually show the list and let them pick.

Tip: Grab the id from the chosen result. The next step (/stationboard) accepts either the name or the id, and the id is unambiguous when several stations share a name.

From Quiz: WEBT / External Webservices | Updated: Jul 14, 2026