Resources
GET Resources¶
Get the resources for a certain bucket.
curl 'https://{root_url}/bucket-planning/v2/buckets/058904e3-f70e-4cad-86d5-a7325517a795/resources/' \
-H 'apikey: {YOUR_API_KEY}'
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": "3756417c-33a1-4b7d-86a6-7cfa69a6c3f7",
"algorithm_fields": {},
"driver_capacity": 1000.0,
"driver_capacity_vector": null,
"vehicle_capacity": 900.0,
"vehicle_capacity_vector": null,
"created": "2019-08-06T13:44:10Z",
"modified": "2019-08-06T13:44:27Z",
"external_data": {},
"current_state": "planned",
"old_state": "new",
"state_reason": null,
"initial_cost": 0.0,
"dist_cost": null,
"time_cost": null,
"maximum_route_distance_meters": null,
"bucket": "058904e3-f70e-4cad-86d5-a7325517a795",
"resource_event_tags": []
}
]
}
Available query params¶
Name | format | Description | Example |
---|---|---|---|
current_state | Enum | Filter by resource state | current_state=initialized |
limit | Integer | Sets the maximum amount of results the request answer is going to contain | limit=2 |
offset | Integer | Sets the initial index from which the results are going to be returned. | offset=10 |
POST Resources¶
Add a resource to a bucket.
curl https://{root_url}/bucket-planning/v2/buckets/058904e3-f70e-4cad-86d5-a7325517a795/resources/ \
-H 'Content-Type: application/json' \
-H 'apikey: {YOUR_API_KEY}' \
-d '{
"algorithm_fields": {},
"driver_capacity": 1000.0,
"vehicle_capacity": 900.0,
"external_data": {}
}'
{
"id": "21ec214a-685f-48bb-87cf-e1a155a7ce82",
"algorithm_fields": {},
"created": "2019-08-30T14:15:01Z",
"modified": "2019-08-30T14:15:01Z",
"external_data": {},
"current_state": "new",
"old_state": "empty",
"state_reason": null,
"driver_capacity": 1000.0,
"driver_capacity_vector": null,
"vehicle_capacity": 900.0,
"vehicle_capacity_vector": null,
"initial_cost": 0.0,
"dist_cost": null,
"time_cost": null,
"maximum_route_distance_meters": null,
"bucket": "058904e3-f70e-4cad-86d5-a7325517a795",
"resource_event_tags": []
}
POST Resources for intermediate depots¶
Find all the intermediate depots examples here
POST Resources in bulk¶
Add multiple resources to a single bucket with a single request.
curl https://{root_url}/bucket-planning/v2/buckets/058904e3-f70e-4cad-86d5-a7325517a795/resources/bulk/ \
-H 'Content-Type: application/json' \
-H 'apikey: {YOUR_API_KEY}' \
-d '[
{
"algorithm_fields": {},
"driver_capacity": 1000.0,
"vehicle_capacity": 900.0,
"external_data": {}
},
{
"algorithm_fields": {},
"driver_capacity": 1200.0,
"vehicle_capacity": 800.0,
"external_data": {},
"resource_event_tags": ["tag4"]
}
]'
[
{
"id": "21ec214a-685f-48bb-87cf-e1a155a7ce82",
"algorithm_fields": {},
"driver_capacity": 1000.0,
"vehicle_capacity": 900.0,
"driver_capacity_vector": null,
"vehicle_capacity_vector": null,
"created": "2019-08-30T14:15:37Z",
"modified": "2019-08-30T14:15:37Z",
"external_data": {},
"current_state": "new",
"old_state": "empty",
"state_reason": null,
"initial_cost": 0.0,
"dist_cost": null,
"time_cost": null,
"maximum_route_distance_meters": null,
"bucket": "058904e3-f70e-4cad-86d5-a7325517a795",
"resource_event_tags": []
},
{
"id": "a03d3b81-3726-420c-bdc2-3c1a34bc92a9",
"algorithm_fields": {},
"driver_capacity": 1200.0,
"vehicle_capacity": 800.0,
"driver_capacity_vector": null,
"vehicle_capacity_vector": null,
"created": "2019-08-30T14:15:37Z",
"modified": "2019-08-30T14:15:37Z",
"external_data": {},
"current_state": "new",
"old_state": "empty",
"state_reason": null,
"initial_cost": 0.0,
"dist_cost": null,
"time_cost": null,
"maximum_route_distance_meters": null,
"bucket": "058904e3-f70e-4cad-86d5-a7325517a795",
"resource_event_tags": ["tag4"]
}
]
POST to remove the resource from the planning¶
curl 'https://{root_url}/bucket-planning/v2/buckets/058904e3-f70e-4cad-86d5-a7325517a795/resources/21ec214a-685f-48bb-87cf-e1a155a7ce82/actions/' \
-H 'Content-Type: application/json' \
-H 'apikey: {YOUR_API_KEY}' \
-d '{"action" : "cancel"}'
{
"id": "21ec214a-685f-48bb-87cf-e1a155a7ce82",
"algorithm_fields": {},
"driver_capacity": 1000.0,
"vehicle_capacity": 900.0,
"driver_capacity_vector": null,
"vehicle_capacity_vector": null,
"initial_cost": 0.0,
"dist_cost": null,
"time_cost": null,
"maximum_route_distance_meters": null,
"created": "2019-11-25T16:13:58Z",
"modified": "2019-11-25T16:15:29Z",
"external_data": {},
"current_state": "cancelled",
"old_state": "planned",
"state_reason": "_/21ec214a-685f-48bb-87cf-e1a155a7ce82",
"bucket": "058904e3-f70e-4cad-86d5-a7325517a795",
"resource_event_tags": []
}