# Request

Last updated:

<!-- -->

October 18, 2026

<!-- -->

\| 6 minutes read

<br />

<br />

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[​](#request-object-fields "Direct link to Request Object Fields")

| Field               | Type    | Description                                                                                                                  |
| ------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `id`                | Integer | Unique identifier for the request.                                                                                           |
| `optimizationId`    | Integer | The ID of the associated optimization.<br />*Only available in the JSON response if the request is an optimization request.* |
| `routeId`           | Integer | The ID of the associated route.<br />*Only available in the JSON response if the request is a route request.*                |
| `status`            | Integer | Current status of the request:`0` - Created`1` - Pending`2` - Finished`3` - Canceled                                         |
| `message`           | String  | Status message for the request.                                                                                              |
| `creationTimestamp` | Integer | Timestamp when the request was created.                                                                                      |

***

## Endpoints[​](#endpoints "Direct link to Endpoints")

### 1. Get All Requests[​](#1-get-all-requests "Direct link to 1. Get All Requests")

**Description:** Fetches a list of all requests.

* **Base URL:** `https://api.magiclane.net/api/v1`
* **Endpoint:** `GET /fleetmanagement/requests`
* **Headers:**
  * `Authorization: YOUR_API_KEY`
* **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:[​](#example "Direct link to Example:")

* **Response Body:** (error code `200`)

- Schema View
- JSON Example
- JSON View

* ▶`requests`(

  <!-- -->

  array\[object]

  <!-- -->

  )

  List of request objects.

```json
{
  "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
    }
  ]
}

```

```json
{
  "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[​](#2-get-a-request-by-id "Direct link to 2. Get a Request by ID")

**Description:** Retrieves a specific request by ID.

* **Base URL:** `https://api.magiclane.net/api/v1`
* **Endpoint:** `GET /fleetmanagement/requests/{id}`
* **Headers:**
  * `Authorization: YOUR_API_KEY`
* **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:[​](#example-1 "Direct link to Example:")

* **Response Body:** (error code `200`)

note

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:

  <br />

  `0` - Created

  <br />

  `1` - Pending

  <br />

  `2` - Finished

  <br />

  `3` - Canceled

- `message`(

  <!-- -->

  string

  <!-- -->

  )

  Status message for the request.

- `creationTimestamp`(

  <!-- -->

  integer

  <!-- -->

  )

  Timestamp when the request was created.

```json
{
  "id": 23567,
  "routeId": 46587,
  "status": 0,
  "message": "Operation done successfully!",
  "creationTimestamp": 1747786578
}

```

```json
{
  "id": 0,
  "routeId": 0,
  "status": 0,
  "message": "string",
  "creationTimestamp": 0
}

```

***

### 3. Cancel Request[​](#3-cancel-request "Direct link to 3. Cancel Request")

**Description:** Cancel request.

* **Base URL:** `https://api.magiclane.net/api/v1`
* **Endpoint:** `DELETE /fleetmanagement/requests`
* **Headers:**
  * `Authorization: YOUR_API_KEY`
* **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.                  |

note

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:[​](#example-2 "Direct link to Example:")

* **Response Body:** (error code `200`)

```json
{
  "message":  "Operation done successfully!"
}

```

***
