Asynchronous import routes from a given VRP task

Adds information about routes, couriers, orders to the database. You can get information about the import process using a GET /api/v2/companies/{company_id}/routes:vrp-task-import/{id}.

Request

POST

https://courier.yandex.ru/api/v2/companies/{company_id}/routes:vrp-task-import

Path parameters

Name

Description

company_id*

Type: string

Company ID used in requests to the Track & Trace API.

Query parameters

Name

Description

vrp_task_id*

Type: string

Task ID of a problem solved in VRP Planning. It can be MVRP or SVRP task. Result of this task will be used to import routes.

import_mode

Type: string

Defines mode of handling routes import. Valid values are: - ADD_ALL: - imports all routes. This assumes that none of the imported orders already exist. If this is not true such import will lead to an error. - REPLACE_ALL: - deletes existing routes related to a depot and a date specified in the task, and adds all routes as new. Orders associated with the deleted routes are also deleted. - REPLACE_NOT_STARTED: - similar to REPLACE_ALL but keeps routes with courier positions. Orders which are present in those started tracks are not imported again.

Default: ADD_ALL

Enum: ADD_ALL, REPLACE_ALL, REPLACE_NOT_STARTED

initial_order_status

Type: string

Status of created orders. Possible values: NEW, CONFIRMED.

Default: NEW

Enum: NEW, CONFIRMED

original_vrp_task_id

Type: string

Task ID of an original problem solved in VRP Planning. It is needed for reference to rented vehicles.

Responses

200 OK

Request successfully queued.

Body

application/json
{
    "id": "string",
    "status": "IN_PROGRESS",
    "create_time": 0,
    "update_time": 0
}

Name

Description

create_time

Type: number

UNIX timestamp of request creation.

id

Type: string

The ID of asynchronous request.

status

Type: RouteImportStatus

Status of request processing. ERROR: request processing error. Error description is presented in response. IN_PROGRESS: request is being processed. SUCCESS: request processing is completed. Result routes are presented in response.

Enum: IN_PROGRESS, SUCCESS, ERROR

update_time

Type: number

UNIX timestamp of request status update.

RouteImportStatus

Status of request processing. ERROR: request processing error. Error description is presented in response. IN_PROGRESS: request is being processed. SUCCESS: request processing is completed. Result routes are presented in response.

Type

Description

RouteImportStatus

Enum: IN_PROGRESS, SUCCESS, ERROR

400 Bad Request

Incorrect input.

401 Unauthorized

Authorization failed. Send the correct OAuth token in the authorization header.

403 Forbidden

You do not have access to this object.

422 Unprocessable Entity

Invalid parameters were passed.

Body

application/json
{
    "message": "string",
    "incident_id": "string"
}

Name

Description

incident_id*

Type: string

Unique identifier of error incident. In case of API error, this identifier can be provided to support for investigation.

message*

Type: string

Human-readable error description.

504 Gateway Timeout

Server error during request processing.