Task

A Task is a pickup, delivery, visit or any other transaction event being performed by the Driver on a Trip.

The Task object

Property Type Description
id uuid string Unique identifier for the object
trip_id uuid string The id of the trip to which the task belongs
order_id string An identifier for the task that can based on your internal ids
destination JSON The destination object where the task is performed
driver JSON The driver object who is assigned to the task
action string The action to be performed. Can be pickup, delivery, dropoff, visit, stopover or task.
status string The task status. Can be not_started, assigned, dispatching, on_the_way, arriving, arrived, completed, aborted, canceled
committed_eta ISO datetime string The eta commitment made to the customer. This is used to calculate on-time performance.
initial_eta ISO datetime string The initial eta calculated for the task
eta ISO datetime string The current eta for the task, calculated in real-time
start_time ISO datetime string The time at which the task was started
start_location GeoJSON point The location where the task started
completion_time ISO datetime string The time at which the task was completed
completion_location GeoJSON point The location where the task was completed
tracking_url string The URL at which this task can be tracked
tracking_urls array A list of tracking URL objects which include the link to track and the editable type (not editable, multiple, once)
distance integer The distance covered while on the task, in meters
encoded_polyline string The encoded polyline of locations while on the task
time_aware_polyline string The time aware polyline of the locations and timestamps
created_at ISO datetime string Timestamp of when task was created
modified_at ISO datetime string Timestamp of when task was modified

Create a Task

Creates a new task object.

HTTP Request

POST https://app.hypertrack.io/api/v1/tasks/

Returns

Returns a task object if the call succeeded.

Parameters

Parameter Required Description
destination_id No The id of the destination where the task will be performed
destination No The Destination object where the task will be performed. Only one of destination or destination_id must be specified.
action No The action of the task, possible values are pickup, delivery, dropoff, visit, stopover or task. Defaults to task.
order_id No An id that you can specify based on your internal ids
committed_eta No The eta commitment made to the customer to measure on-time performance
curl -H "Authorization: token YOUR_SK_TOKEN" \
     -H "Content-Type: application/json" \
     -X POST \
     -d "{\"destination_id\": \"f3ead2ae-dc0a-4a7e-85be-74ee51d9d70a\", \"committed_eta\": \"2016-03-09T07:00:00.00Z\"}" \
     https://app.hypertrack.io/api/v1/tasks/
hypertrack.Task.create(
    destination_id='f3ead2ae-dc0a-4a7e-85be-74ee51d9d70a',
    committed_eta='2016-03-09T07:00:00.00Z'
)

Example response

{
  "id":"77b9a3fa-a3ab-4840-aadb-cd33442ca45b",
  "trip_id":null,
  "destination_id":"26be07ec-a054-4506-9709-6d3ca3eb0df7",
  "driver_id":null,
  "action":"pickup",
  "status":"dispatching",
  "eta":null,
  "initial_eta":null,
  "committed_eta":"2016-03-09T07:00:00.00Z",
  "start_time":null,
  "start_location":null,
  "completion_time":null,
  "completion_location":null,
  "order_id":"abc123",
  "tracking_url": "http://eta.fyi/sArlTh",
  "tracking_urls": [
    {
      "editable": "not editable",
      "number_of_edits": 0,
      "tracking_url": "http://eta.fyi/sArlTh"
    }
  ],
  "created_at":"2016-03-09T06:00:18.648755Z",
  "modified_at":"2016-03-09T06:00:18.648785Z"
}

Complete a Task

Completes a Task.

[warning] Completing tasks

Only tasks that have been assigned can be completed.

HTTP Request

POST https://app.hypertrack.io/api/v1/tasks/<id>/completed/

Returns

Returns a task object if the call succeeded.

Parameters

Parameter Required Description
completion_time No Timestamp when task is completed, default to current time
completion_location No Location at which task is completed
curl -H "Authorization: token YOUR_SK_TOKEN" \
     -H "Content-Type: application/json" \
     -X POST \
     https://app.hypertrack.io/api/v1/tasks/77b9a3fa-a3ab-4840-aadb-cd33442ca45b/completed/

% sample lang="python" %}

task = hypertrack.Task.retrieve('ce2102c3-b411-4481-b13e-87559f2b441f')
task.complete()

Cancel Task

Cancels a Task. Canceled tasks cannot be restarted, removed or completed.

HTTP Request

POST https://app.hypertrack.io/api/v1/tasks/<id>/canceled/

Returns

Returns a task object if the call succeeded.

Parameters

Parameter Required Description
cancelation_time No Timestamp when task is canceled, default to current time
curl -H "Authorization: token YOUR_SK_TOKEN" \
     -H "Content-Type: application/json" \
     -X POST \
     https://app.hypertrack.io/api/v1/tasks/77b9a3fa-a3ab-4840-aadb-cd33442ca45b/canceled/

% sample lang="python" %}

task = hypertrack.Task.retrieve('ce2102c3-b411-4481-b13e-87559f2b441f')
task.cancel()

Retrieve a Task

Retrieves a task object with the id.

HTTP Request

GET https://app.hypertrack.io/api/v1/tasks/<id>/

Returns

Returns a task object if the call succeeded.

curl -H "Authorization: token YOUR_PK_TOKEN" \
     -H "Content-Type: application/json" \
     -X GET \
     https://app.hypertrack.io/api/v1/tasks/77b9a3fa-a3ab-4840-aadb-cd33442ca45b/

% sample lang="python" %}

task = hypertrack.Task.retrieve('ce2102c3-b411-4481-b13e-87559f2b441f')

Update Destination location

Updates the location of the destination of the task.

HTTP Request

POST https://app.hypertrack.io/api/v1/tasks/<id>/update_destination/

Returns

Returns a task object if the call succeeded.

Parameters

Parameter Required Description
location Yes The latitude and longitude of the new destination location as a GeoJSON point
curl -H "Authorization: token YOUR_SK_TOKEN" \
     -H "Content-Type: application/json" \
     -X POST \
     -d "{\"location\": {\"coordinates\": [-122.402, 37.789], \"type\": \"Point\"}}" \
     https://app.hypertrack.io/api/v1/tasks/77b9a3fa-a3ab-4840-aadb-cd33442ca45b/update_destination/

List all Tasks

List all tasks objects. The list can be filtered using the following parameters.

HTTP Request

GET https://app.hypertrack.io/api/v1/tasks/

Returns

Returns a list of tasks.

Parameters

Parameter Required Description
page_size No Maximum number of objects to return, default is 50
driver_id No Filter tasks that are assigned to a driver
destination_id No Filter tasks for a particular destination
order_id No Filter tasks by order id
min_date No Filter objects by minimum created at date
max_date No Filter objects by maximum created at date
curl -H "Authorization: token YOUR_SK_TOKEN" \
     -X GET \
     https://app.hypertrack.io/api/v1/tasks/?page_size=20

% sample lang="python" %}

tasks = hypertrack.Task.list()

Delete a Task

Delete an existing task object.

HTTP Request

DELETE https://app.hypertrack.io/api/v1/tasks/<id>/

Returns

Empty response if the object is deleted.

curl -H "Authorization: token YOUR_SK_TOKEN" \
     -X DELETE \
     https://app.hypertrack.io/api/v1/tasks/f3ead2ae-dc0a-4a7e-85be-74ee51d9d70a/

% sample lang="python" %}

task = hypertrack.Task.retrieve('ce2102c3-b411-4481-b13e-87559f2b441f')
task.delete()

Example response

{}

Was this helpful? Yes, thanks! Not really

results matching ""

    No results matching ""