RTTI Open API - Overview
The Real-Time Transit Information Open API is REST (Representational State Transfer); however this API is read only, i.e. http get calls.
- The API default is to return XML data, however, it can return JSON if the content-type: application/JSON or accept: application/JSON is set in the http request header.
- The API will require a unique API key to request for data.
- The API key will authorize to offer a maximum of 1,000 requests per day for use of the Data. This is to prevent malicious users from abusing our service. This might change and is open for discussion.
- The API will provide services for Stops, Buses, Stop Estimates, and Route details.
- Route url site will be http://api.translink.ca.
Query Types and Parameters
There are two main types of queries, ID queries and Filter queries.
ID queries return a single result. They specify the ID of the desired resource. E.g. http://api.translink.ca/RTTIAPI/V1/stops/55612?apiKey=[APIKey]
Filter queries specify the results by passing in URL parameters. You can, for example, filter bus results according to a given stop number and route number. E.g. http://api.translink.ca/RTTIAPI/V1/stops?apiKey=[APIKey]&lat=49.187706&long=-122.850060
The API key (apikey) is a mandatory parameter that is required in every request. Failure to provide a valid or active API key will result in a 403 HTTP response.
XML or JSON Specification
You can choose to either have the result set delivered as XML or JSON. This is done by specifying the "content-type" or "accept" in the http header as "application/XML" or "application/JSON". If this is left out of the http request, the result set will return XML.