REST Resource: providers.deliveryVehicles

Resource: DeliveryVehicle

The DeliveryVehicle message. A delivery vehicle transports shipments from a depot to a delivery location, and from a pickup location to the depot. In some cases, delivery vehicles also transport shipments directly from the pickup location to the delivery location.

Note: gRPC and REST APIs use different field naming conventions. For example, the DeliveryVehicle.current_route_segment field in the gRPC API and the DeliveryVehicle.currentRouteSegment field in the REST API refer to the same field.

JSON representation
{
  "name": string,
  "lastLocation": {
    object (DeliveryVehicleLocation)
  },
  "navigationStatus": enum (DeliveryVehicleNavigationStatus),
  "currentRouteSegment": string,
  "currentRouteSegmentEndPoint": {
    object (LatLng)
  },
  "remainingDistanceMeters": integer,
  "remainingDuration": string,
  "remainingVehicleJourneySegments": [
    {
      object (VehicleJourneySegment)
    }
  ],
  "attributes": [
    {
      object (DeliveryVehicleAttribute)
    }
  ],
  "type": enum (DeliveryVehicleType)
}
Fields
name

string

The unique name of this Delivery Vehicle. The format is providers/{provider}/deliveryVehicles/{vehicle}.

lastLocation

object (DeliveryVehicleLocation)

The last reported location of the Delivery Vehicle.

navigationStatus

enum (DeliveryVehicleNavigationStatus)

The Delivery Vehicle's navigation status.

currentRouteSegment

string (bytes format)

The encoded polyline specifying the route that the navigation recommends taking to the next waypoint. Your driver app updates this when a stop is reached or passed, and when the navigation reroutes. These LatLngs are returned in Task.journey_sharing_info.remaining_vehicle_journey_segments[0].path (gRPC) or Task.journeySharingInfo.remainingVehicleJourneySegments[0].path (REST) for all active Tasks assigned to the Vehicle.

There are a few cases where this field might not be used to populate Task.journey_sharing_info.remaining_vehicle_journey_segments[0].path (gRPC) or Task.journeySharingInfo.remainingVehicleJourneySegments[0].path (REST):

  • The endpoint of the currentRouteSegment does not match DeliveryVehicle.remaining_vehicle_journey_segments[0].stop (gRPC) or DeliveryVehicle.remainingVehicleJourneySegments[0].stop (REST).

  • The driver app has not updated its location recently, so the last updated value for this field might be stale.

  • The driver app has recently updated its location, but the currentRouteSegment is stale, and points to a previous vehicle stop.

In these cases, Fleet Engine populates this field with a route from the most recently passed VehicleStop to the upcoming VehicleStop to ensure that the consumer of this field has the best available information on the current path of the Delivery Vehicle.

A base64-encoded string.

currentRouteSegmentEndPoint

object (LatLng)

The location where the currentRouteSegment ends. This is not currently populated by the driver app, but you can supply it on deliveryVehicles.patch calls. It is either the LatLng from the upcoming vehicle stop, or the last LatLng of the currentRouteSegment. Fleet Engine will then do its best to interpolate to an actual VehicleStop.

This field is ignored in deliveryVehicles.patch calls if the currentRouteSegment field is empty.

remainingDistanceMeters

integer

The remaining driving distance for the currentRouteSegment. The Driver app typically provides this field, but there are some circumstances in which Fleet Engine will override the value sent by the app. For more information, see DeliveryVehicle.current_route_segment. This field is returned in Task.remaining_vehicle_journey_segments[0].driving_distance_meters (gRPC) or Task.remainingVehicleJourneySegments[0].drivingDistanceMeters (REST) for all active Tasks assigned to the Delivery Vehicle.

Fleet Engine ignores this field in UpdateDeliveryVehicleRequest if the currentRouteSegment field is empty.

remainingDuration

string (Duration format)

The remaining driving time for the currentRouteSegment. The Driver app typically provides this field, but there are some circumstances in which Fleet Engine will override the value sent by the app. For more information, see DeliveryVehicle.current_route_segment. This field is returned in Task.remaining_vehicle_journey_segments[0].driving_duration (gRPC) or Task.remainingVehicleJourneySegments[0].drivingDuration (REST) for all active tasks assigned to the Delivery Vehicle.

Fleet Engine ignores this field in UpdateDeliveryVehicleRequest if the currentRouteSegment field is empty.

A duration in seconds with up to nine fractional digits, ending with 's'. Example: "3.5s".

remainingVehicleJourneySegments[]

object (VehicleJourneySegment)

The journey segments assigned to this Delivery Vehicle, starting from the Vehicle's most recently reported location. This field won't be populated in the response of deliveryVehicles.list.

attributes[]

object (DeliveryVehicleAttribute)

A list of custom Delivery Vehicle attributes. A Delivery Vehicle can have at most 100 attributes, and each attribute must have a unique key.

type

enum (DeliveryVehicleType)

The type of this delivery vehicle. If unset, this will default to AUTO.

DeliveryVehicleNavigationStatus

The vehicle's navigation status.

Enums
UNKNOWN_NAVIGATION_STATUS Unspecified navigation status.
NO_GUIDANCE The Driver app's navigation is in FREE_NAV mode.
ENROUTE_TO_DESTINATION Turn-by-turn navigation is available and the Driver app navigation has entered GUIDED_NAV mode.
OFF_ROUTE The vehicle has gone off the suggested route.
ARRIVED_AT_DESTINATION The vehicle is within approximately 50m of the destination.

DeliveryVehicleAttribute

Describes a vehicle attribute as a key-value pair. The "key:value" string length cannot exceed 256 characters.

JSON representation
{
  "key": string,
  "value": string,

  // Union field delivery_vehicle_attribute_value can be only one of the
  // following:
  "stringValue": string,
  "boolValue": boolean,
  "numberValue": number
  // End of list of possible types for union field
  // delivery_vehicle_attribute_value.
}
Fields
key

string

The attribute's key.

value

string

The attribute's value.

Union field delivery_vehicle_attribute_value. The attribute's value, can be in string, bool, or double type. delivery_vehicle_attribute_value can be only one of the following:
stringValue

string

String typed attribute value.

Note: This is identical to the value field which will eventually be deprecated. For create or update methods, either field can be used, but it's strongly recommended to use stringValue. If both stringValue and value are set, they must be identical or an error will be thrown. Both fields are populated in responses.

boolValue

boolean

Boolean typed attribute value.

numberValue

number

Double typed attribute value.

DeliveryVehicleType

The type of delivery vehicle.

Enums
DELIVERY_VEHICLE_TYPE_UNSPECIFIED The value is unused.
AUTO An automobile.
TWO_WHEELER A motorcycle, moped, or other two-wheeled vehicle
BICYCLE Human-powered transport.
PEDESTRIAN A human transporter, typically walking or running, traveling along pedestrian pathways.

Methods

create

Creates and returns a new DeliveryVehicle.

get

Returns the specified DeliveryVehicle instance.

list

Gets all DeliveryVehicles that meet the specified filtering criteria.

patch

Writes updated DeliveryVehicle data to Fleet Engine, and assigns Tasks to the DeliveryVehicle.