Skip to content

Routes

GET Routes

curl 'https://{root_url}/bucket-planning/v2/buckets/0dbabdb5-14b6-4a74-a02d-f26286e04478/ \
  -H 'apikey: {YOUR_API_KEY}'
{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": "f0d25219-91a7-40e4-abfe-43708f72a5d5",
      "algorithm_fields": {
        "departure_stop": {
          "min_time": "2023-10-25T05:49:00Z",
          "max_time": "2023-10-25T05:50:00Z",
          "geo_point": {
            "latitude": 52.230501,
            "longitude": 6.207016
          },
          "stop_time": 60.0
        },
        "arrival_stop": {
          "min_time": "2023-10-25T05:50:00Z",
          "max_time": "2023-10-25T13:59:00Z",
          "geo_point": {
            "latitude": 52.230501,
            "longitude": 6.207016
          },
          "stop_time": 0.0
        },
        "timeslot_windows": [
          {
            "min_time": "2023-10-25T05:49:00Z",
            "max_time": "2023-10-25T05:50:00Z",
            "id": null
          },
          {
            "min_time": "2023-10-25T05:50:00Z",
            "max_time": "2023-10-25T13:58:00Z",
            "id": null
          },
          {
            "min_time": "2023-10-25T13:58:00Z",
            "max_time": "2023-10-25T13:59:00Z",
            "id": null
          }
        ],
        "break_duration": 900,
        "break_interval": 10800
      },
      "events": [],
      "created": "2023-10-20T00:37:04Z",
      "modified": "2023-10-25T00:16:09Z",
      "external_data": {},
      "current_state": "planned",
      "old_state": "new",
      "state_reason": null,
      "bucket": "0dbabdb5-14b6-4a74-a02d-f26286e04478",
      "resource": null,
      "time_cost": null,
      "route_event_tags": [],
      "capacity_threshold": null,
      "capacity_threshold_vector": {
        "capacity_1": 0.5,
        "capacity_2": 0.99,
        "capacity_3": 0.5,
        "capacity_4": null,
        "capacity_5": null
      },
      "time_threshold": 0.9,
      "intermediate_depot_duration": 1020,
      "resource_route_tag": null,
      "break_geopoint": null,
    }
  ]
}

Available query params

Name format Description Example
resource GUID Filter by resource id resource=090908c3-2a8d-49a7-ad8a-7aabc72aaaf1
has_resource Boolean Filters by the existence of resources. has_resource=True
current_state Enum Filter by route current state current_state=initialized
old_state Enum Filter by route old 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
event__order_by String Sorts the events in the route by a certain attribute. event_order_by=sort_key

POST Routes

curl https://{root_url}/bucket-planning/v2/buckets/0dbabdb5-14b6-4a74-a02d-f26286e04478/routes/ \
  -H 'Content-Type: application/json' \
  -H 'apikey: {YOUR_API_KEY}' \
  -d '
  {
    "algorithm_fields": {
      "departure_stop": {
        "geo_point": {
          "latitude": 52.230501,
          "longitude": 6.207016
        },
        "min_time": "2023-10-25T05:49:00Z",
        "max_time": "2023-10-25T05:50:00Z",
        "stop_time": 60.0
      },
      "arrival_stop": {
        "geo_point": {
          "latitude": 52.230501,
          "longitude": 6.207016
        },
        "min_time": "2023-10-25T05:50:00Z",
        "max_time": "2023-10-25T13:59:00Z",
        "stop_time": 0.0
      },
      "timeslot_windows": [
        {
          "min_time": "2023-10-25T05:49:00Z",
          "max_time": "2023-10-25T05:50:00Z",
          "id": null
        },
        {
          "min_time": "2023-10-25T05:50:00Z",
          "max_time": "2023-10-25T13:58:00Z",
          "id": null
        },
        {
          "min_time": "2023-10-25T13:58:00Z",
          "max_time": "2023-10-25T13:59:00Z",
          "id": null
        }
      ],
      "break_interval": 10800,
      "break_duration": 900
    },
    "external_data": {},
    "route_event_tags": ["tag4"],
    "resource_route_tag": null,
    "break_geopoint": null
  }
'
{
  "id": "447d0c27-0fb3-49ad-a358-c26ebdb08860",
  "algorithm_fields": {
    "departure_stop": {
      "min_time": "2023-10-25T05:49:00Z",
      "max_time": "2023-10-25T05:50:00Z",
      "geo_point": {
        "latitude": 52.230501,
        "longitude": 6.207016
      },
      "stop_time": 60.0
    },
    "arrival_stop": {
      "min_time": "2023-10-25T05:50:00Z",
      "max_time": "2023-10-25T13:59:00Z",
      "geo_point": {
        "latitude": 52.230501,
        "longitude": 6.207016
      },
      "stop_time": 0.0
    },
    "timeslot_windows": [
      {
        "min_time": "2023-10-25T05:49:00Z",
        "max_time": "2023-10-25T05:50:00Z",
        "id": null
      },
      {
        "min_time": "2023-10-25T05:50:00Z",
        "max_time": "2023-10-25T13:58:00Z",
        "id": null
      },
      {
        "min_time": "2023-10-25T13:58:00Z",
        "max_time": "2023-10-25T13:59:00Z",
        "id": null
      }
    ],
    "break_duration": 900,
    "break_interval": 10800
  },
  "bucket": "fa56d140-2f66-4a7c-a884-19122ea094e5",
  "resource": null,
  "events": [],
  "current_state": "new",
  "old_state": "empty",
  "state_reason": null,
  "created": "2023-10-25T12:21:36Z",
  "modified": "2023-10-25T12:21:36Z",
  "external_data": {},
  "resource_route_tag": null,
  "break_geopoint": null,
  "route_event_tags": [
    "tag4"
  ],
  "time_cost": null
}

POST Routes with intermediate depots

Find all the intermediate depots examples here

POST Routes in Bulk

curl https://{root_url}/bucket-planning/v2/buckets/0dbabdb5-14b6-4a74-a02d-f26286e04478/routes/bulk/ \
  -H 'Content-Type: application/json' \
  -H 'apikey: {YOUR_API_KEY}' \
  -d '[
  {
    "algorithm_fields": {
      "departure_stop": {
        "geo_point": {
          "latitude": 52.230501,
          "longitude": 6.207016
        },
        "min_time": "2023-10-25T05:49:00Z",
        "max_time": "2023-10-25T05:50:00Z",
        "stop_time": 60.0
      },
      "arrival_stop": {
        "geo_point": {
          "latitude": 52.230501,
          "longitude": 6.207016
        },
        "min_time": "2023-10-25T05:50:00Z",
        "max_time": "2023-10-25T13:59:00Z",
        "stop_time": 0.0
      },
      "timeslot_windows": [
        {
          "min_time": "2023-10-25T05:49:00Z",
          "max_time": "2023-10-25T05:50:00Z",
          "id": null
        },
        {
          "min_time": "2023-10-25T05:50:00Z",
          "max_time": "2023-10-25T13:58:00Z",
          "id": null
        },
        {
          "min_time": "2023-10-25T13:58:00Z",
          "max_time": "2023-10-25T13:59:00Z",
          "id": null
        }
      ],
      "break_interval": 10800,
      "break_duration": 900
    },
    "external_data": {},
    "route_event_tags": ["tag4"],
    "resource_route_tag": null,
    "break_geopoint": null
  },
  {
    "algorithm_fields": {
      "departure_stop": {
        "geo_point": {
          "latitude": 52.230501,
          "longitude": 6.207016
        },
        "min_time": "2023-10-25T05:49:00Z",
        "max_time": "2023-10-25T05:50:00Z",
        "stop_time": 70.0
      },
      "arrival_stop": {
        "geo_point": {
          "latitude": 52.230501,
          "longitude": 6.207016
        },
        "min_time": "2023-10-25T05:50:00Z",
        "max_time": "2023-10-25T13:59:00Z",
        "stop_time": 0.0
      },
      "timeslot_windows": [
        {
          "min_time": "2023-10-25T05:49:00Z",
          "max_time": "2023-10-25T05:50:00Z",
          "id": null
        },
        {
          "min_time": "2023-10-25T05:50:00Z",
          "max_time": "2023-10-25T13:58:00Z",
          "id": null
        },
        {
          "min_time": "2023-10-25T13:58:00Z",
          "max_time": "2023-10-25T13:59:00Z",
          "id": null
        }
      ],
      "break_interval": 10800,
      "break_duration": 900
    },
    "external_data": {},
    "route_event_tags": [],
    "resource_route_tag": null,
    "break_geopoint": null
  }
]'
[
  {
    "id": "ff3cad05-73d0-4534-91ac-fa54bc8ff9a6",
    "algorithm_fields": {
      "departure_stop": {
        "min_time": "2023-10-25T05:49:00Z",
        "max_time": "2023-10-25T05:50:00Z",
        "geo_point": {
          "latitude": 52.230501,
          "longitude": 6.207016
        },
        "stop_time": 60.0
      },
      "arrival_stop": {
        "min_time": "2023-10-25T05:50:00Z",
        "max_time": "2023-10-25T13:59:00Z",
        "geo_point": {
          "latitude": 52.230501,
          "longitude": 6.207016
        },
        "stop_time": 0.0
      },
      "timeslot_windows": [
        {
          "min_time": "2023-10-25T05:49:00Z",
          "max_time": "2023-10-25T05:50:00Z",
          "id": null
        },
        {
          "min_time": "2023-10-25T05:50:00Z",
          "max_time": "2023-10-25T13:58:00Z",
          "id": null
        },
        {
          "min_time": "2023-10-25T13:58:00Z",
          "max_time": "2023-10-25T13:59:00Z",
          "id": null
        }
      ],
      "break_duration": 900,
      "break_interval": 10800
    },
    "bucket": "fa56d140-2f66-4a7c-a884-19122ea094e5",
    "resource": null,
    "events": [],
    "current_state": "new",
    "old_state": "empty",
    "state_reason": null,
    "created": "2023-10-25T12:35:55Z",
    "modified": "2023-10-25T12:35:55Z",
    "external_data": {},
    "resource_route_tag": null,
    "break_geopoint": null,
    "route_event_tags": [
      "tag4"
    ],
    "time_cost": null
  },
  {
    "id": "00acecd7-731c-4ba2-af6a-b4337c79c587",
    "algorithm_fields": {
      "departure_stop": {
        "min_time": "2023-10-25T05:49:00Z",
        "max_time": "2023-10-25T05:50:00Z",
        "geo_point": {
          "latitude": 52.230501,
          "longitude": 6.207016
        },
        "stop_time": 70.0
      },
      "arrival_stop": {
        "min_time": "2023-10-25T05:50:00Z",
        "max_time": "2023-10-25T13:59:00Z",
        "geo_point": {
          "latitude": 52.230501,
          "longitude": 6.207016
        },
        "stop_time": 0.0
      },
      "timeslot_windows": [
        {
          "min_time": "2023-10-25T05:49:00Z",
          "max_time": "2023-10-25T05:50:00Z",
          "id": null
        },
        {
          "min_time": "2023-10-25T05:50:00Z",
          "max_time": "2023-10-25T13:58:00Z",
          "id": null
        },
        {
          "min_time": "2023-10-25T13:58:00Z",
          "max_time": "2023-10-25T13:59:00Z",
          "id": null
        }
      ],
      "break_duration": 900,
      "break_interval": 10800
    },
    "bucket": "fa56d140-2f66-4a7c-a884-19122ea094e5",
    "resource": null,
    "events": [],
    "current_state": "new",
    "old_state": "empty",
    "state_reason": null,
    "created": "2023-10-25T12:35:55Z",
    "modified": "2023-10-25T12:35:55Z",
    "external_data": {},
    "resource_route_tag": null,
    "break_geopoint": null,
    "route_event_tags": [],
    "time_cost": null
  }
]

CANCEL a route

curl 'https://{root_url}/bucket-planning/v2/buckets/0dbabdb5-14b6-4a74-a02d-f26286e04478/routes/f0d25219-91a7-40e4-abfe-43708f72a5d5/actions/' \
  -H 'Content-Type: application/json' \
  -H 'apikey: {YOUR_API_KEY}' \
  -d '{"action" : "cancel"}'
{
  "id": "447d0c27-0fb3-49ad-a358-c26ebdb08860",
  "algorithm_fields": {
    "departure_stop": {
      "min_time": "2023-10-25T05:49:00Z",
      "max_time": "2023-10-25T05:50:00Z",
      "geo_point": {
        "latitude": 52.230501,
        "longitude": 6.207016
      },
      "stop_time": 60.0
    },
    "arrival_stop": {
      "min_time": "2023-10-25T05:50:00Z",
      "max_time": "2023-10-25T13:59:00Z",
      "geo_point": {
        "latitude": 52.230501,
        "longitude": 6.207016
      },
      "stop_time": 0.0
    },
    "timeslot_windows": [
      {
        "min_time": "2023-10-25T05:49:00Z",
        "max_time": "2023-10-25T05:50:00Z",
        "id": null
      },
      {
        "min_time": "2023-10-25T05:50:00Z",
        "max_time": "2023-10-25T13:58:00Z",
        "id": null
      },
      {
        "min_time": "2023-10-25T13:58:00Z",
        "max_time": "2023-10-25T13:59:00Z",
        "id": null
      }
    ],
    "break_duration": 900,
    "break_interval": 10800
  },
  "bucket": "fa56d140-2f66-4a7c-a884-19122ea094e5",
  "resource": null,
  "events": [],
  "current_state": "cancelled",
  "old_state": "new",
  "state_reason": "_/447d0c27-0fb3-49ad-a358-c26ebdb08860",
  "created": "2023-10-25T12:21:36Z",
  "modified": "2023-10-25T12:37:16Z",
  "external_data": {},
  "resource_route_tag": null,
  "break_geopoint": null,
  "route_event_tags": [
    "tag4"
  ],
  "time_cost": null
}