Introduction
This service provides a GraphQL API for fetching/streaming live vehicle-positions.
The API is explorable in our GraphQL IDE: https://api.entur.io/graphql-explorer/vehicles-v2.
Query
Enables fetching vehicle-positions in a GraphQL API.
Base URL: https://api.entur.io/realtime/v2/vehicles/graphql
Example:
{
vehicles(codespaceId:"ATB") {
lastUpdated
location {
latitude
longitude
}
}
}
Subscription
Enables creating a GraphQL-subscription that will open a websocket and let the server stream all updates to the client continuously.
Base URL: wss://api.entur.io/realtime/v2/vehicles/subscriptions
(Uses the websocket-protocol graphql-ws
)
Example:
subscription {
vehicles(codespaceId:"ATB") {
lastUpdated
location {
latitude
longitude
}
}
}
More details about GraphQL-subscriptions: https://graphql.org/blog/subscriptions-in-graphql-and-relay/