Courier breaks
You can set courier breaks during route planning, after the route has been exported to Track & Trace, and even when the courier is already en route. Breaks aren't displayed on the map, but are considered when ETA is calculated.
Add a break
To add breaks to the courier's route, send a POST request to the resource work_breaks.
In the request, specify company_id
and route_id
.
In the request body, specify:
rest_duration_s
: Break duration in seconds (the minimum value is 1).work_time_range_till_rest
: Working hours before break, in the following format: [D.]HH[:MM[:SS]] - [D.]HH[:MM[:SS]].
Request
cURL
curl -H "Content-Type: application/json" -H "Authorization: OAuth <your-token>" -X POST -d @<Path_to_file_in_UTF-8_encoding> https://courier.yandex.ru/api/v1/companies/<your-company-id>/routes/<route-id>/work_breaks
File
[
{
"work_time_range_till_rest": "01:00:00-01:30:00",
"rest_duration_s": 3600
},
{
"work_time_range_till_rest": "02:30:00-03:00:00",
"rest_duration_s": 1800
}
]
Result
[
{
"break_id": 1,
"sequence_pos": 0,
"work_time_range_till_rest": "01:00:00 - 01:30:00",
"rest_duration_s": 1800
},
{
"break_id": 2,
"sequence_pos": 1,
"work_time_range_till_rest": "02:30:00 - 03:00:00",
"rest_duration_s": 1800
},
]
Get break information
To get information about courier breaks on the route, send a GET request to the resource work_breaks.
Request
cURL
curl -H "Content-Type: application/json" -H "Authorization: OAuth <your-token>" -X GET -d https://courier.yandex.ru/api/v1/companies/<your-company-id>/routes/<route-id>/work_breaks
Result
[
{
"id": 1,
"sequence_pos": 0,
"work_time_range_till_rest": "01:00:00 - 01:30:00",
"rest_duration_s": 3600
},
{
"id": 2,
"sequence_pos": 1,
"work_time_range_till_rest": "02:30:00 - 03:00:00",
"rest_duration_s": 1800
}
]
Delete a break
To delete a break, send a DELETE request to the resource work_breaks.
Request
cURL
curl -H "Content-Type: application/json" -H "Authorization: OAuth <your-token>" -X DELETE -d https://courier.yandex.ru/api/v1/companies/<your-company-id>/routes/<route-id>/work_breaks/<break-id>
Result
{
"id": 1,
"sequence_pos": 0
}