REST Resource: providers.tasks

Resource: Task

A Task in the Delivery API represents a single action to track. In general, there is a distinction between shipment-related Tasks and break Tasks. A shipment can have multiple Tasks associated with it. For example, there could be one Task for the pickup, and one for the drop-off or transfer. Also, different Tasks for a given shipment can be handled by different vehicles. For example, one vehicle could handle the pickup, driving the shipment to the hub, while another vehicle drives the same shipment from the hub to the drop-off location.

Note: gRPC and REST APIs use different field naming conventions. For example, the Task.journey_sharing_info field in the gRPC API and the Task.journeySharingInfo field in the REST API refer to the same field.

JSON representation
{
  "name": string,
  "type": enum (Type),
  "state": enum (State),
  "taskOutcome": enum (TaskOutcome),
  "taskOutcomeTime": string,
  "taskOutcomeLocation": {
    object (LocationInfo)
  },
  "taskOutcomeLocationSource": enum (TaskOutcomeLocationSource),
  "trackingId": string,
  "deliveryVehicleId": string,
  "plannedLocation": {
    object (LocationInfo)
  },
  "taskDuration": string,
  "targetTimeWindow": {
    object (TimeWindow)
  },
  "journeySharingInfo": {
    object (JourneySharingInfo)
  },
  "taskTrackingViewConfig": {
    object (TaskTrackingViewConfig)
  },
  "attributes": [
    {
      object (TaskAttribute)
    }
  ]
}
Fields
name

string

Must be in the format providers/{provider}/tasks/{task}.

type

enum (Type)

Required. Immutable. Defines the type of the Task. For example, a break or shipment.

state

enum (State)

Required. The current execution state of the Task.

taskOutcome

enum (TaskOutcome)

The outcome of the Task.

taskOutcomeTime

string (Timestamp format)

The timestamp that indicates when the Task's outcome was set by the provider.

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

taskOutcomeLocation

object (LocationInfo)

The location where the Task's outcome was set. This value is updated as part of tasks.patch. If this value isn't explicitly updated by the provider, then Fleet Engine populates it by default with the last known vehicle location (the raw location).

taskOutcomeLocationSource

enum (TaskOutcomeLocationSource)

Indicates where the value of the taskOutcomeLocation came from.

trackingId

string

Immutable. This field facilitates the storing of an ID so you can avoid using a complicated mapping. You cannot set trackingId for Tasks of type UNAVAILABLE and SCHEDULED_STOP. These IDs are subject to the following restrictions:

  • Must be a valid Unicode string.
  • Limited to a maximum length of 64 characters.
  • Normalized according to Unicode Normalization Form C.
  • May not contain any of the following ASCII characters: '/', ':', '?', ',', or '#'.
deliveryVehicleId

string

Output only. The ID of the vehicle that is executing this Task. Delivery Vehicle IDs are subject to the following restrictions:

  • Must be a valid Unicode string.
  • Limited to a maximum length of 64 characters.
  • Normalized according to Unicode Normalization Form C.
  • May not contain any of the following ASCII characters: '/', ':', '?', ',', or '#'.
plannedLocation

object (LocationInfo)

Immutable. The location where the Task will be completed. Optional for UNAVAILABLE Tasks, but required for all other Tasks.

taskDuration

string (Duration format)

Required. Immutable. The time needed to execute a Task at this location.

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

targetTimeWindow

object (TimeWindow)

The time window during which the task should be completed.

journeySharingInfo

object (JourneySharingInfo)

Output only. Journey sharing-specific fields. Not populated when state is CLOSED.

taskTrackingViewConfig

object (TaskTrackingViewConfig)

The configuration for task tracking that specifies which data elements are visible to the end users under what circumstances.

attributes[]

object (TaskAttribute)

A list of custom Task attributes. Each attribute must have a unique key.

Type

The type of Task.

Enums
TYPE_UNSPECIFIED Default, the Task type is unknown.
PICKUP A pickup Task is the action taken for picking up a shipment from a customer. Depot or feeder vehicle pickups should use the SCHEDULED_STOP type.
DELIVERY A delivery Task is the action taken for delivering a shipment to an end customer. Depot or feeder vehicle dropoffs should use the SCHEDULED_STOP type.
SCHEDULED_STOP A scheduled stop Task is used for planning purposes. For example, it could represent picking up or dropping off shipments from feeder vehicles or depots. It shouldn't be used for any shipments that are picked up or dropped off from an end customer.
UNAVAILABLE A Task that means the Vehicle is not available for service. For example, this can happen when the driver takes a break, or when the vehicle is being refueled.

TaskOutcomeLocationSource

The identity of the source that populated the taskOutcomeLocation.

Enums
TASK_OUTCOME_LOCATION_SOURCE_UNSPECIFIED The task outcome before it is set.
PROVIDER The provider-specified the taskOutcomeLocation.
LAST_VEHICLE_LOCATION The provider didn't specify the taskOutcomeLocation, so Fleet Engine used the last known vehicle location.

JourneySharingInfo

Journey sharing specific fields.

JSON representation
{
  "remainingVehicleJourneySegments": [
    {
      object (VehicleJourneySegment)
    }
  ],
  "lastLocation": {
    object (DeliveryVehicleLocation)
  },
  "lastLocationSnappable": boolean
}
Fields
remainingVehicleJourneySegments[]

object (VehicleJourneySegment)

Tracking information for the stops that the assigned vehicle will make before it completes this Task. Note that this list can contain stops from other tasks.

The first segment, Task.journey_sharing_info.remaining_vehicle_journey_segments[0] (gRPC) or Task.journeySharingInfo.remainingVehicleJourneySegments[0] (REST), contains route information from the driver's last known location to the upcoming VehicleStop. Current route information usually comes from the driver app, except for some cases noted in the documentation for DeliveryVehicle.current_route_segment. The other segments in Task.journey_sharing_info.remaining_vehicle_journey_segments (gRPC) or Task.journeySharingInfo.remainingVehicleJourneySegments (REST) are populated by Fleet Engine. They provide route information between the remaining VehicleStops.

lastLocation

object (DeliveryVehicleLocation)

Indicates the vehicle's last reported location of the assigned vehicle.

lastLocationSnappable

boolean

Indicates whether the vehicle's lastLocation can be snapped to the currentRouteSegment. This value is False if either lastLocation or currentRouteSegment don't exist. This value is computed by Fleet Engine. Updates from clients are ignored.

TaskTrackingViewConfig

The configuration message that defines when a data element of a Task should be visible to the end users.

JSON representation
{
  "routePolylinePointsVisibility": {
    object (VisibilityOption)
  },
  "estimatedArrivalTimeVisibility": {
    object (VisibilityOption)
  },
  "estimatedTaskCompletionTimeVisibility": {
    object (VisibilityOption)
  },
  "remainingDrivingDistanceVisibility": {
    object (VisibilityOption)
  },
  "remainingStopCountVisibility": {
    object (VisibilityOption)
  },
  "vehicleLocationVisibility": {
    object (VisibilityOption)
  }
}
Fields
routePolylinePointsVisibility

object (VisibilityOption)

The field that specifies when route polyline points can be visible. If this field is not specified, the project level default visibility configuration for this data will be used.

estimatedArrivalTimeVisibility

object (VisibilityOption)

The field that specifies when estimated arrival time can be visible. If this field is not specified, the project level default visibility configuration for this data will be used.

estimatedTaskCompletionTimeVisibility

object (VisibilityOption)

The field that specifies when estimated task completion time can be visible. If this field is not specified, the project level default visibility configuration for this data will be used.

remainingDrivingDistanceVisibility

object (VisibilityOption)

The field that specifies when remaining driving distance can be visible. If this field is not specified, the project level default visibility configuration for this data will be used.

remainingStopCountVisibility

object (VisibilityOption)

The field that specifies when remaining stop count can be visible. If this field is not specified, the project level default visibility configuration for this data will be used.

vehicleLocationVisibility

object (VisibilityOption)

The field that specifies when vehicle location can be visible. If this field is not specified, the project level default visibility configuration for this data will be used.

VisibilityOption

The option message that defines when a data element should be visible to the end users.

JSON representation
{

  // Union field visibility_option can be only one of the following:
  "remainingStopCountThreshold": integer,
  "durationUntilEstimatedArrivalTimeThreshold": string,
  "remainingDrivingDistanceMetersThreshold": integer,
  "always": boolean,
  "never": boolean
  // End of list of possible types for union field visibility_option.
}
Fields
Union field visibility_option. The specific visibility option chosen. visibility_option can be only one of the following:
remainingStopCountThreshold

integer

This data element is visible to the end users if the remaining stop count <= remainingStopCountThreshold.

durationUntilEstimatedArrivalTimeThreshold

string (Duration format)

This data element is visible to the end users if the ETA to the stop <= durationUntilEstimatedArrivalTimeThreshold.

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

remainingDrivingDistanceMetersThreshold

integer

This data element is visible to the end users if the remaining driving distance in meters <= remainingDrivingDistanceMetersThreshold.

always

boolean

If set to true, this data element is always visible to the end users with no thresholds. This field cannot be set to false.

never

boolean

If set to true, this data element is always hidden from the end users with no thresholds. This field cannot be set to false.

Methods

batchCreate

Creates and returns a batch of new Task objects.

create

Creates and returns a new Task object.

get

Gets information about a Task.

list

Gets all Tasks that meet the specified filtering criteria.

patch

Updates Task data.