Route Listing Query for Redispatch CT-e
The route listing API for redispatch CT-e allows you to query the routes generated on behalf of the carrier.
It uses the GET method and returns data for the generated routes.
Importante:
Para segurança será utilizado OAuth
HTTP Request
GET https://api.mercadolibre.com/MLB/routes/redispatch
Example
bash1curl --request GET \ 2 --url 'https://api.mercadolibre.com/MLB/routes/redispatch?initial_date=2024-01-01&end_date=2024-01-05&step_type=first_mile' \ 3 --header 'Authorization: Bearer SEU_ACCESS_TOKEN' \ 4 --header 'Accept: application/json' \ 5 --header 'Content-Type: application/json'
Parameters
Parameter | Type | Description |
|---|---|---|
| initial_date | String | Start date of the query. If not provided, the current date is assumed. |
| end_date | String | End date of the query. If not provided, the current date is assumed. The date range cannot exceed 7 days. |
| page | Int | Specifies the page index to be queried. If not provided, the value 1 is assumed. |
| limit | Int | Specifies the maximum number of samples per page. If not provided, the value 100 is assumed. |
| step_type | String | Segment the carrier wants to query. It can be first_mile, middle_mile, or last_mile. |
Response
json1{ 2 "total_elements": 10, 3 "page": 1, 4 "limit": 100, 5 "routes": [ 6 { 7 "id": 123336466, 8 "date": "2024-01-04T00:00:00Z", 9 "total_cte": 25, 10 "status": "GENERATING"|"GENERATED" 11 }, 12 // Other elements... 13 ] 14}
Description
Parameter | Type | Description |
|---|---|---|
| total_elements | Int | Total number of CT-e routes found. |
| page | Int | Current page number of the request. |
| limit | Int | Maximum number of results per page. |
| routes | Array | List of routes. |
| id | Int | Route identifier. |
| date | String | Date recorded for the route. |
| total_cte | Int | Number of CT-e documents registered for the route. |
| status | String | Defines if all shipments documents where already generated. If status is GENERATED the MDFe can be generated by the carrier |
Status Code
The API uses HTTP status codes to indicate different request states. Below are the most common codes and their descriptions.
HTTP Code | Content Type | Response Body | Description |
|---|---|---|---|
| 200 | application/json | (example above) | Returns the route data. |
| 400 | application/json | json<br>{<br> "error": "invalid_range_date",<br> "status": 400,<br> "message": "The range must be within 7 days.",<br> "cause": []<br>}<br> | Returned when the date range exceeds 7 days. |
| 400 | application/json | json<br>{<br> "error": "invalid_date",<br> "status": 400,<br> "message": "Invalid date",<br> "cause": []<br>}<br> | Returned when the date format is invalid or the start date is later than the end date. |
