It is highly recommended to use GraphiQL when familiarizing yourself with the Routing API.
GraphiQL is a simple UI for making queries. You can use it both to run queries and to explore the GraphQL schema.
Note: All top level queries should have at least some description available and you can use the documentation explorer to familiarize yourself with the schema. You can find more details about that under Reading schema docs.
Using our hosted browser versions for the three available regions. The browser versions have the correct endpoints configured already.
All options work similarly and their UI looks more or less like this (ChromeiQL extension has been used in the example below):
Region | Endpoint |
---|---|
Helsinki region | https://api.digitransit.fi/routing/v1/routers/hsl/index/graphql |
Waltti regions | https://api.digitransit.fi/routing/v1/routers/waltti/index/graphql |
Entire Finland | https://api.digitransit.fi/routing/v1/routers/finland/index/graphql |
{
stop(id: "HSL:1040129") {
name
lat
lon
wheelchairBoarding
}
}
{
"data": {
"stop": {
"name": "Arkadian puisto",
"lat": 60.17112,
"lon": 24.93338,
"wheelchairBoarding": "NOT_POSSIBLE"
}
}
}
Note: If the example provided does not return what is expected then the stop id used in step 2 may not be in use any more and you should try again with an existing id.
GraphiQL is schema aware. This means that you can invoke autocomplete by Ctrl-space. The tool then shows available options for your query.
By clicking < Docs in the upper right corner of GraphiQL, you can open the Documentation Explorer. Then, clicking query: QueryType will open up a list of all available top level queries.
From here you can check e.g. alerts, which describes what can be queried using that top level. It says "Get all alerts active in the graph".
Let's try to query alerts:
{
alerts {
alertDescriptionText
}
}