Open Data Platform Swiss Public Transport offers different APIs.
An API keyword is required to access these APIs. This token can be obtained via the Developer Portal. The token must also be sent in the HTTP header as “Authorization” for each request. Its use is subject to certain restrictions.
The Developer Portal allows:
- API keys to be created
- API keys to be deleted
- The observation of how much of the allocation is used up by the key.
APIs available
TRIAS / VDV 431:
- Departure / arrival display (TRIAS 2020)
- TripRequest (TRIAS 2020)
- Trip forecast (TRIAS 2020)
- LocationInformationRequest (TRIAS 2020)
OJP:
GTFS-RT:
These APIs are NOT REST APIs, which means that they cannot be described simply either using tools like Swagger. The required document is available via the links.
VDV 431: Properties
VDV 431 is NOT a REST service. Via a single access point
https://api.opentransportdata.swiss/trias2020
requests can be submitted via “POST”.
(NB: No “/” at the end in the call)
The Authorization Header must contain the API key.
Content type must be set to “text/XML” or “application/XML”.
The response is always an XML structure which depends on the service. This must then be processed.
Access to “data” in static datasets via API
“Data” in CKAN can also be processed via an API. This is not subject to the key’s restrictions. An example about stops can be found in the Cookbook.