Request
The Request Rest API allows you to manage requests within the Fleet Management system. You can create, retrieve, update, and delete request data. This Rest API supports filtering, sorting, and pagination to help manage large datasets efficiently.
Request Object Fields
| Field | Type | Description |
|---|---|---|
id | Integer | Unique identifier for the request. |
optimizationId | Integer | The ID of the associated optimization. |
routeId | Integer | The ID of the associated route. |
status | Integer | Current status of the request: 0 - Created1 - Pending2 - Finished3 - Canceled |
message | String | Status message for the request. |
creationTimestamp | Integer | Timestamp when the request was created. |
Endpoints
1. Get All Requests
Description: Fetches a list of all requests.
- Method:
GET - Endpoint:
/requests - Headers:
Authorization: YOUR_API_KEY
- URL:
https://fleetmanagement.magiclaneapis.com/v1/requests - Returned error codes:
| Error Code | Description |
|---|---|
200 Successful | Successful operation. |
400 Bad Request | Invalid input or missing required fields. |
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
- ▶
requests(array[object])List of request objects.
{
"requests": [
{
"id": 23412,
"optimizationId": 32754,
"status": 0,
"message": "Operation done successfully!",
"creationTimestamp": 1747834619
},
{
"id": 23456,
"routeId": 46578,
"status": 0,
"message": "Operation done successfully!",
"creationTimestamp": 1745676643
},
{
"id": 23567,
"routeId": 46587,
"status": 0,
"message": "Operation done successfully!",
"creationTimestamp": 1747786578
}
]
}
{
"requests": [
{
"id": 0,
"optimizationId": 0,
"status": 0,
"message": "string",
"creationTimestamp": 0
},
{
"id": 0,
"routeId": 0,
"status": 0,
"message": "string",
"creationTimestamp": 0
},
{
"id": 0,
"routeId": 0,
"status": 0,
"message": "string",
"creationTimestamp": 0
}
]
}
2. Get a Request by ID
Description: Retrieves a specific request by ID.
- Method:
GET - Endpoint:
/requests/{id} - Headers:
Authorization: YOUR_API_KEY
- URL:
https://fleetmanagement.magiclaneapis.com/v1/requests/{id} - Path Parameter:
id(integer) - The unique request ID.
- Returned error codes:
| Error Code | Description |
|---|---|
200 Successful | Successful operation. |
400 Bad Request | Invalid input or missing required fields. |
401 Unauthorized | API key is missing or invalid. |
404 Not Found | Request not found in database. |
405 Method Not Allowed | Incorrect method type. |
500 Internal Server Error | Database error occurred. |
Example:
- Response Body: (error code
200)
In this example, the request contains only the routeId, which means it is a route request.
- Schema View
- JSON Example
- JSON View
id(integer)Unique identifier for the request.optimizationId(integer)The ID of the associated optimization. Only present for optimization requests.routeId(integer)The ID of the associated route. Only present for route requests.status(integer)Current status of the request:0- Created1- Pending2- Finished3- Canceledmessage(string)Status message for the request.creationTimestamp(integer)Timestamp when the request was created.
{
"id": 23567,
"routeId": 46587,
"status": 0,
"message": "Operation done successfully!",
"creationTimestamp": 1747786578
}
{
"id": 0,
"routeId": 0,
"status": 0,
"message": "string",
"creationTimestamp": 0
}
3. Cancel Request
Description: Cancel request.
- Method:
DELETE - Endpoint:
/requests - Headers:
Authorization: YOUR_API_KEY
- URL:
https://fleetmanagement.magiclaneapis.com/v1/requests - Path Parameter:
id(integer) - The unique request ID.
- Returned error codes:
| Error Code | Description |
|---|---|
200 Successful | Successful operation. |
400 Bad Request | Request done, cannot be canceled anymore. |
401 Unauthorized | API key is missing or invalid. |
404 Not Found | Request not found in database. |
405 Method Not Allowed | Incorrect method type. |
500 Internal Server Error | Database error occurred. |
When a request is canceled, the corresponding operation that the request is tracking is also canceled. This means that any ongoing processes or actions associated with this request will be stopped immediately, ensuring that no further progress is made on the task.
Example:
- Response Body: (error code
200)
{
"message": "Operation done successfully!"
}