Mục lục tài liệu
PUT
/addons/route-optimization/jobs/{jobId}/baseline
Attach or replace the baseline of a finished job
Stores the partner's own plan for the job's orders, same body as the baseline field of POST /jobs, so GET /jobs/:id/result can compare plan versus plan. No core run, no quota charge, no webhook. A second call replaces the first and clears its remeasure.
Đường dẫn
PUT
/api/v1/partners/addons/route-optimization/jobs/{jobId}/baselineXác thực yêu cầu
api-keyVí dụ gọi bằng curl
curl -X PUT "https://api.route4green.com/api/v1/partners/addons/route-optimization/jobs/{jobId}/baseline" \
-H "api-key: YOUR_API_KEY" \
-H "content-type: application/json" \
-d '{
"km_type": {},
"includes_return_to_depot": false,
"routes": [
{
"vehicle_ref": "string",
"order_ids": [
"string"
],
"distance_km": 0,
"duration_minutes": 0
}
],
"km_basis": {},
"sequence_known": false
}'Tham số
| Tên | Vị trí | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|---|
| jobId | path | string (uuid) | Có |
Nội dung gửi lên
| Trường | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| km_type | road | straight_line | Có | How the baseline distances were measured: 'road' (road network distance) or 'straight_line' (as the crow flies). Distance deltas are only reported for 'road'. |
| includes_return_to_depot | boolean | Có | Whether each baseline distance_km includes the return leg to the depot |
| routes | object[] | Có | The partner's own plan for the same orders, one entry per planned route. Orders absent from every route are the baseline's unassigned orders. |
| km_basis | reported | remeasure | Không | Which km the comparison uses. 'reported' (default) compares the submitted distance_km against the Route4Green route distances. 'remeasure' measures both plans as closed loops from the depot on the same self-hosted road engine (OSRM) and compares those; the reported figures are used instead when the road engine is unavailable. |
| sequence_known | boolean | Không | Whether each route's order_ids list the real stop order (default true). false means the order is not known, so baseline routes are not remeasured. |
Các trường của routes
| Trường | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| vehicle_ref | string | Có | The partner's own label for the vehicle that ran this planned route. It may or may not match an external_vehicle_id. Unique within the baseline. |
| order_ids | string[] | Có | external_order_id values of this job's orders, in the partner's planned stop order. An order may appear in at most one baseline route. |
| distance_km | number | Không | Planned distance of this route in kilometres, measured as declared by km_type and includes_return_to_depot. Omit it or send null when the plan has no km for the route (never 0 as a placeholder): the reported km comparison then has no baseline total and no km deltas (reason BASELINE_KM_UNREPORTED), while km_basis 'remeasure' still measures the route on the road engine |
| duration_minutes | number | Không | Planned duration of this route, in minutes |
5 trườngRouteOptimizationBaselineDto
Kết quả trả về
200Baseline stored, wrapped in the success envelope400ROUTE_OPT_VALIDATION_ERROR: invalid body, more routes than the vehicle cap, a vehicle_ref used twice, an order not in the job or an order on two routes404ROUTE_OPT_JOB_NOT_FOUND409ROUTE_OPT_BASELINE_JOB_NOT_FINISHED: the job is not SUCCEEDED or PARTIAL410RESULT_PURGED: the job data was deleted after retention429ROUTE_OPT_RATE_LIMITED