Route calculation and estimated arrival time
This API builds a route between two points and provides the estimated arrival time depending on the selected transport mode.
How to get data
Method
GET
Request address
To get the data, use the address: https://<server_address>/api/api.php?
Request parameters
-
cmd=route — command to build the route
-
mode — transport type, one of:
-
bicycle — bicycle
-
bus — bus
-
car — car
-
pedestrian — pedestrian
-
scooter — scooter
-
taxi — taxi
-
truck — truck
-
origin — starting point coordinates (lat,long)
-
destination — destination point coordinates (lat,long)
-
node — node number where the command should be executed
Example request
https://<server_address>/api/api.php?cmd=route&mode=bus&origin=47.211908,39.613767&destination=47.201699,39.668183&node=1
|
Response
{
"code": 0,
"data": {
"routes": [
{
"id": "79de74af-5040-441a-ab7a-62d3d9f7a4b4",
"sections": [
{
"id": "2cc5fff7-fd4f-43ac-bcda-00d662207c63",
"type": "vehicle",
"departure": {
"time": "2023-02-22T09:40:07+03:00",
"place": {
"type": "place",
"location": {
"lat": 47.2119,
"long": 39.61372
},
"originalLocation": {
"lat": 47.211908,
"long": 39.613767
}
}
},
"arrival": {
"time": "2023-02-22T09:52:32+03:00",
"place": {
"type": "place",
"location": {
"lat": 47.2017113,
"long": 39.668221
},
"originalLocation": {
"lat": 47.201699,
"long": 39.668183
}
}
},
"summary": {
"duration": 745,
"length": 5452,
"baseDuration": 530
},
"transport": {
"mode": "bus"
}
}
]
}
]
}
}
|
In response to the API request, the following is returned:
-
code — result code (0 = success)
-
routes — list of calculated routes
-
sections — route segments containing:
-
departure / arrival — departure and arrival times and coordinates
-
summary — trip duration and distance
-
transport.mode — selected transport type