Bus status
This API returns the current status of a bus: its route, the current and next stops, as well as route information (number, fare, interval, etc.).
How to get data
Method
GET
Request address
To get the data, use the address: https://<server_address>/api/api.php?
Request parameters
-
cmd=currentBusState — command to get the bus status
-
vehnum — bus number
-
node — node number where the command should be executed
Example request
https://<server_address>/api/api.php?cmd=currentBusState&vehnum=А%20086%20КХ%20116%20RUS&node=1
|
Response
{
"code": 0,
"lines": [
{
"id": 1086,
"name": "1A",
"number": "1A",
"bidirectional": 1,
"description": "1A",
"active": 1,
"price": "25.00",
"interval": 10,
"folder": null,
"currentstop_id": 0,
"currentstop_order": 0,
"nextstop_id": 5217,
"nextstop_order": 48
}
]
}
|
In response to the API request, the following is returned:
-
id — route ID
-
name — route name
-
number — route number
-
bidirectional — route direction flag (1 = bidirectional, 0 = one-way)
-
active — route activity flag (1 = active)
-
price — fare price
-
interval — interval between buses in minutes
-
currentstop_id — ID of the stop where the bus is currently located
-
currentstop_order — sequence number of the current stop
-
nextstop_id — ID of the next stop
-
nextstop_order — sequence number of the next stop