Route
The Route Rest API allows you to manage route data, including retrieving, updating, and deleting routes. This Rest API supports multiple request types to interact with route solutions and optimization processes.
Route Object Fields
| Field | Type | Description |
|---|---|---|
id | Integer | Unique identifier for the route. |
optimizationId | Integer | ID of the associated optimization. |
idVehicle | Integer | ID of the vehicle assigned to this route. |
matrixBuiltType | Integer | Distance calculation method: 0 - Set by user using "matrices" field1 - Real road distances and times |
matrices | Array | Contains distance and time matrices (set only if matrixBuiltType = 0). |
configurationParameters | Object | Configuration parameters for the route. |
orders | Array | List of orders included in the route. |
departure | Object | Details of the departure location. |
destination | Object | Details of the destination location. |
vehicleConstraints | Array | List of vehicle constraints applied to the route. |
rideStatus | Integer | Current status of the ride. |
totalDistance | Float | Total route distance (in kilometers or miles based on settings). |
totalTime | Integer | Total duration of the route (in seconds). |
totalServiceTime | Integer | Total service time for all orders in the route (in seconds). |
totalWaitTime | Integer | Total wait time for the route (in seconds). |
neededFuel | Float | Total fuel consumption for the route (liters or kWh based on fuel type). |
price | Float | Total cost of the route, calculated based on fuel consumption and distance. |
shape | String | Encoded polyline or list of locations representing the route. |
creationTimestamp | Integer | Timestamp of when the route was created. |
Endpoints
1. Get All Routes
Description: Fetches all available routes.
- Method:
GET - Endpoint:
/routes - Headers:
Authorization: YOUR_API_KEY
- URL:
https://fleetmanagement.magiclaneapis.com/v1/routes - Query Parameters:
search(string, optional) - General search term.
- Returned error codes:
| Error Code | Description |
|---|---|
200 Successful | Successful operation. |
400 Bad Request | The values sent for page and per_page parameters are incorrect; should be greater than 0. |
401 Unauthorized | API key is missing or invalid. |
405 Method Not Allowed | Incorrect method type. |
500 Internal Server Error | Database error occurred. |
Example:
- Response Body: (error code
200)
- Schema View
- JSON Example
- JSON View
id(integer)Unique identifier for the route.optimizationId(integer)ID of the associated optimization.- ▶
configurationParameters(object)Configuration parameters for the route. - ▶
vehicleConstraints(array[object])List of vehicle constraints applied to the route. rideStatus(integer)Current status of the ride.
Possible values:
•0- Finished: The ride is completed
•1- New: The ride is ready to start
•2- Started: The ride has begun
•3- Canceled by Driver: The ride was canceled by the driver
•4- Canceled by Fleet: The ride was canceled by fleet management- ▶
vehicle(object)Vehicle assigned to this route. - ▶
departure(object)Details of the departure location.