Skip to content

Upsert Vehicle

Request

Create or update a Vehicle. A unique ID is required to identify the Vehicle. Calling this endpoint with an existing id will update the Vehicle.

Modifying (or retrieving) a Vehicle will provide the caller with a version number for this Vehicle. This version can be passed to the upsert endpoint as a weak ETag in the If-Match header. This allows the caller to ensure that the Vehicle has not been modified since the last time it was retrieved.

Security
clientCredentials
Path
idstring, <= 512 characters^[a-zA-Z0-9.~\-_]+$required

Unique identifier for this Vehicle. Should only contain characters which do not need URL encoding.

Headers
PreferArray of strings

The RFC7240 Prefer header indicates that a particular server behavior is preferred by the client but is not required for successful completion of the request (see RFC 7240).

The following behavior (see Examples) is supported by this API:

  • return=<minimal|representation> is used to suggest the server to return using 204 without resource (minimal) or using 200 or 201 with resource (representation) in the response body on success.
Examples:
minimal
Indicate no response is needed, can be omitted
["return=minimal"]
representation
Request the result of the operation as response
["return=representation"]
If-Matchstring

Weak Etag used for optimistic locking.

Example:W/"24"
Bodyapplication/json
descriptionstring, [ 1 .. 999 ] characters

Description of the vehicle.

Example:"Horn plays La Cucaracha - use sparingly in residential areas"
mandatoryboolean

Whether OptiFlow must use this vehicle in a planning or not. If false, OptiFlow will only use this vehicle when it makes sense to do so.

Default:false
Example:true
driverobject(Driver)
startobject(Start)required
endobject(End)required
deployabilityobject(Deployability)required
capabilitiesArray of strings, unique

Capabilities this vehicle provides. Used to make sure that orders requiring a specific capability, are only handled by vehicles with that capability. Note: if a capability contains a dash, it will be split into two capabilities upon exporting and re-importing the vehicle set in PTV OptiFlow Route Optimization.

Default:[]
Example:
[ "refrigerated", "hazmat" ]
transport_resourceobject(TransportResource)
labelsArray of strings, unique

Labels for categorizing vehicles. Can be used for facility filtering or defining constraints. Note: if a label contains a dash, it will be split into two labels upon exporting and re-importing the vehicle set in PTV OptiFlow Route Optimization.

Default:[]
Example:
[ "priority", "express" ]
costobject(Cost)
route_settingsobject(RouteSettings)
colorstring

The color used to display this vehicle's route in the planning overview. Accepts CSS color names (e.g., "red", "blue") or hexadecimal color codes (e.g., "#FF5733", "#123DEF").

Example:"#FF5733"
break_rule_groupstring

Break Rule group for this vehicle. Allows bulk assignment of break rules to all vehicles in the group during planning.

Example:"BELGIUM-LEGAL"
plan_groupstring

Plan group for this vehicle. Can be used for filtering.

Example:"PLAN-GROUP-1"
batteryobject(Battery)

Early Access

curl -i -X PUT \
  'https://developer.conundra.eu/_mock/apis/vehicles/vehicle-api/vehicles/{id}' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -H 'If-Match: W/"24"' \
  -H 'Prefer: return=minimal' \
  -d '{
    "description": "Horn plays La Cucaracha - use sparingly in residential areas",
    "mandatory": true,
    "driver": {
      "name": "John Doe",
      "efficiency_factor": 1.2,
      "custom_data": {
        "something": "customer specific"
      }
    },
    "start": {
      "location": {
        "address": {
          "id": "50.9514048-3.8067878",
          "name": "The office",
          "address_line": "Voordries 41",
          "city": "Oosterzele",
          "zip_code": "9860",
          "country_code": "BE",
          "geo_point": {
            "latitude": 50.9514048,
            "longitude": 3.8067878
          }
        },
        "at_first_activity": false
      },
      "service_time": "PT20M",
      "orders_to_deliver_available": true
    },
    "end": {
      "location": {
        "address": {
          "id": "50.9514048-3.8067878",
          "name": "The office",
          "address_line": "Voordries 41",
          "city": "Oosterzele",
          "zip_code": "9860",
          "country_code": "BE",
          "geo_point": {
            "latitude": 50.9514048,
            "longitude": 3.8067878
          }
        },
        "at_last_activity": false,
        "same_as_start": false
      },
      "service_time": "PT15M",
      "allow_picked_up_orders": true
    },
    "deployability": {
      "window": {
        "start": {
          "earliest": "2025-01-01T08:00:00Z",
          "latest": "2025-01-01T10:00:00Z"
        },
        "end": {
          "latest": "2025-01-01T18:00:00Z"
        }
      },
      "duration": {
        "at_most_without_overtime": "PT8H",
        "allowed_overtime": "PT2H"
      }
    },
    "capabilities": [
      "refrigerated",
      "hazmat"
    ],
    "transport_resource": {
      "license_plate": "1-ABC-234",
      "capacities": [
        {
          "type": "weight",
          "value": 3500
        },
        {
          "type": "volume",
          "value": 25.5
        }
      ],
      "custom_data": {
        "something": "customer specific"
      }
    },
    "labels": [
      "priority",
      "express"
    ],
    "cost": {
      "fixed": 50,
      "per_hour": 25,
      "per_kilometer": 0.5,
      "per_stop": 12,
      "overtime_per_hour": 30
    },
    "route_settings": {
      "routing_group": "medium-truck",
      "max_distance_in_kilometers": 450,
      "max_stops": 10,
      "driving_speed_factor": 1.5,
      "preferred_route_duration": {
        "duration": "PT8H",
        "importance": 0.5
      }
    },
    "color": "#FF5733",
    "break_rule_group": "BELGIUM-LEGAL",
    "plan_group": "PLAN-GROUP-1",
    "battery": {
      "capacity": 1,
      "consumption": {
        "per_hundred_kilometers": 1000
      },
      "state_of_charge": {
        "initial": 1,
        "minimum": 1
      }
    }
  }'

Responses

Vehicle updated

Headers
ETagstring

A weak Etag (ex W/"<etag_value>") which contains the current version of the entity

Example:"W/\"25\""
Preference-Appliedstring

Indicates whether a preference has been applied.

Example:"return=representation"
Locationstring, (URI)

A URI to access the result of the operation.

Bodyapplication/json
idstring, <= 512 characters^[a-zA-Z0-9.~\-_]+$read-only

Unique identifier for this Vehicle.

Example:"truck-42"
descriptionstring, [ 1 .. 999 ] characters

Description of the vehicle.

Example:"Horn plays La Cucaracha - use sparingly in residential areas"
mandatoryboolean

Whether OptiFlow must use this vehicle in a planning or not. If false, OptiFlow will only use this vehicle when it makes sense to do so.

Default:false
Example:true
driverobject(Driver)
startobject(Start)required
endobject(End)required
deployabilityobject(Deployability)required
capabilitiesArray of strings, unique

Capabilities this vehicle provides. Used to make sure that orders requiring a specific capability, are only handled by vehicles with that capability. Note: if a capability contains a dash, it will be split into two capabilities upon exporting and re-importing the vehicle set in PTV OptiFlow Route Optimization.

Default:[]
Example:
[ "refrigerated", "hazmat" ]
transport_resourceobject(TransportResource)
labelsArray of strings, unique

Labels for categorizing vehicles. Can be used for facility filtering or defining constraints. Note: if a label contains a dash, it will be split into two labels upon exporting and re-importing the vehicle set in PTV OptiFlow Route Optimization.

Default:[]
Example:
[ "priority", "express" ]
costobject(Cost)
route_settingsobject(RouteSettings)
colorstring

The color used to display this vehicle's route in the planning overview. Accepts CSS color names (e.g., "red", "blue") or hexadecimal color codes (e.g., "#FF5733", "#123DEF").

Example:"#FF5733"
break_rule_groupstring

Break Rule group for this vehicle. Allows bulk assignment of break rules to all vehicles in the group during planning.

Example:"BELGIUM-LEGAL"
plan_groupstring

Plan group for this vehicle. Can be used for filtering.

Example:"PLAN-GROUP-1"
batteryobject(Battery)

Early Access

Response
{ "id": "truck-42", "description": "Horn plays La Cucaracha - use sparingly in residential areas", "mandatory": true, "driver": { "name": "John Doe", "efficiency_factor": 1.2, "custom_data": {} }, "start": { "location": {}, "service_time": "PT20M", "orders_to_deliver_available": true }, "end": { "location": {}, "service_time": "PT15M", "allow_picked_up_orders": true }, "deployability": { "window": {}, "duration": {} }, "capabilities": [ "refrigerated", "hazmat" ], "transport_resource": { "license_plate": "1-ABC-234", "capacities": [], "custom_data": {} }, "labels": [ "priority", "express" ], "cost": { "fixed": 50, "per_hour": 25, "per_kilometer": 0.5, "per_stop": 12, "overtime_per_hour": 30 }, "route_settings": { "routing_group": "medium-truck", "max_distance_in_kilometers": 450, "max_stops": 10, "driving_speed_factor": 1.5, "preferred_route_duration": {} }, "color": "#FF5733", "break_rule_group": "BELGIUM-LEGAL", "plan_group": "PLAN-GROUP-1", "battery": { "capacity": 1, "consumption": {}, "state_of_charge": {} } }