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 |
---|---|
Timisoara region | https://api.opentransport.ro/routing/v1/routers/timisoara/index/graphql |
Entire Romania | https://api.opentransport.ro/routing/v1/routers/romania/index/graphql |
{
stop(id: "stpt:s2980") {
name
lat
lon
wheelchairBoarding
}
}
{
"data": {
"stop": {
"name": "Complex Studențesc",
"lat": 45.74815,
"lon": 21.23527,
"wheelchairBoarding": "NO_INFORMATION"
}
}
}
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
}
}