Skip to content

Create a new sequence

Request

Creates a new sequence synchronously. The returned sequenceId is usable immediately to fetch the full sequence via GET .../sequences/{sequenceId} or GET .../sequences/latest.

Security
ApiKeyAuth
Path
tourIdstring, (uuid)required

Unique tour identifier (generated by Better Route backend)

Example:3fa85f64-5717-4562-b3fc-2c963f66afa6
Bodyapplication/jsonrequired
modestring(SequenceCreationMode)required

Mode which is used to create a sequence:

  • FIXED_OPTIMIZATION instructs that ETAs of waypoints are to be re-calculated, while the order of the waypoints is mostly kept intact (waypoint may only be moved in certain special cases, like when the time frame changes for a waypoint)
  • FULL_OPTIMIZATION instructs the backend to create an entirely new sequence, without attempts to maintain the previous order of waypoints
  • RETURN_TO_PREVIOUS_WAYPOINT_ORDER can be used to return to a previously used order of waypoints, in a situation when results of running FULL_OPTIMIZATION need to be "undone"
  • USE_PROVIDED instructs the backend to keep the order of the provided waypoint ids (time frames will be ignored)
Enum:"FIXED_OPTIMIZATION""FULL_OPTIMIZATION""RETURN_TO_PREVIOUS_WAYPOINT_ORDER""USE_PROVIDED"
coordsobject(Coordinates)required

A pair of coordinates

startTimestring^([01]\d|2[0-3]):[0-5]\d(:[0-5]\d)?$required

Local time of day, without a timezone offset.

Example:"08:00:00"
waypointIdsArray of strings, (uuid)

List of waypoints IDs representing expected order of waypoints in the generated sequence. When provided, sequence creation mode must be 'USE_PROVIDED'.

firstWaypointIdstring, (uuid)

ID of the waypoint which must become first in the generated sequence. When provided, sequence creation mode must be 'FULL_OPTIMIZATION'.

curl -i -X POST \
  https://dev.routes.bettermile.com/v1/tours/3fa85f64-5717-4562-b3fc-2c963f66afa6/sequences \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: YOUR_API_KEY_HERE' \
  -d '{
    "mode": "FIXED_OPTIMIZATION",
    "coords": {
      "lat": 52.52,
      "lon": 13.405
    },
    "startTime": "08:00:00"
  }'

Responses

Sequence has been successfully created

Bodyapplication/json
dataobject(SequenceCreated)

Output from sequence creation

Example:
{ "sequenceId": 10234 }
Response
{ "data": { "sequenceId": 10234 } }