# REST Resource: providers.deliveryVehicles

- [Resource: DeliveryVehicle](https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/providers.deliveryVehicles#DeliveryVehicle)
  - [JSON representation](https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/providers.deliveryVehicles#DeliveryVehicle.SCHEMA_REPRESENTATION)
- [DeliveryVehicleNavigationStatus](https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/providers.deliveryVehicles#DeliveryVehicleNavigationStatus)
- [DeliveryVehicleAttribute](https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/providers.deliveryVehicles#DeliveryVehicleAttribute)
  - [JSON representation](https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/providers.deliveryVehicles#DeliveryVehicleAttribute.SCHEMA_REPRESENTATION)
- [DeliveryVehicleType](https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/providers.deliveryVehicles#DeliveryVehicleType)
- [Methods](https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/providers.deliveryVehicles#METHODS_SUMMARY)

## 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 (`https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/DeliveryVehicleLocation`) }, "pastLocations": [ { object (`https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/DeliveryVehicleLocation`) } ], "navigationStatus": enum (`https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/providers.deliveryVehicles#DeliveryVehicleNavigationStatus`), "currentRouteSegment": string, "currentRouteSegmentEndPoint": { object (`https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/LatLng`) }, "remainingDistanceMeters": integer, "remainingDuration": string, "remainingVehicleJourneySegments": [ { object (`https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/VehicleJourneySegment`) } ], "attributes": [ { object (`https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/providers.deliveryVehicles#DeliveryVehicleAttribute`) } ], "type": enum (`https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/providers.deliveryVehicles#DeliveryVehicleType`) } ``` |

| Fields ||
|---|---|
| `name` | `string` The unique name of this Delivery Vehicle. The format is `providers/{provider}/deliveryVehicles/{vehicle}`. |
| `lastLocation` | ``object (`https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/DeliveryVehicleLocation`)`` The last reported location of the Delivery Vehicle. |
| `pastLocations[]` | ``object (`https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/DeliveryVehicleLocation`)`` Input only. Locations where this Delivery Vehicle has been in the past that haven't yet been reported to Fleet Engine. This is used in `UpdateDeliveryVehicleRequest` to record locations which were previously unable to be sent to the server. Typically this happens when the Delivery Vehicle does not have internet connectivity. |
| `navigationStatus` | ``enum (`https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/providers.deliveryVehicles#DeliveryVehicleNavigationStatus`)`` The Delivery Vehicle's navigation status. |
| `currentRouteSegment` | `string (https://developers.google.com/discovery/v1/type-format 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 `LatLng`s 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 (`https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/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 `https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/providers.deliveryVehicles#DeliveryVehicle.FIELDS.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 `Task`s assigned to the Delivery Vehicle. Fleet Engine ignores this field in `UpdateDeliveryVehicleRequest` if the `currentRouteSegment` field is empty. |
| `remainingDuration` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#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 `https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/providers.deliveryVehicles#DeliveryVehicle.FIELDS.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 (`https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/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 (`https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/providers.deliveryVehicles#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 (`https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/providers.deliveryVehicles#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 ||
|---|---|
| ### `https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/providers.deliveryVehicles/create` | Creates and returns a new `DeliveryVehicle`. |
| ### `https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/providers.deliveryVehicles/delete` | Deletes a DeliveryVehicle from the Fleet Engine. |
| ### `https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/providers.deliveryVehicles/get` | Returns the specified `DeliveryVehicle` instance. |
| ### `https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/providers.deliveryVehicles/list` | Gets all `DeliveryVehicle`s that meet the specified filtering criteria. |
| ### `https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/providers.deliveryVehicles/patch` | Writes updated `DeliveryVehicle` data to Fleet Engine, and assigns `Tasks` to the `DeliveryVehicle`. |