Action

An Action is a pickup, delivery, visit or any other transaction event being performed by the User.

The Action object

Property Type Description
id uuid string Unique identifier for the object
user JSON The user object to which the action was assigned
type string The type of action, can be pickup, delivery, dropoff, visit, stopover or task
lookup_id string An identifier for the action that can based on your internal ids
assigned_at ISO datetime string The time at which the action was assigned to the user
scheduled_at ISO datetime string The scheduled time by when the action should be completed
expected_place JSON The place object where the action is to be completed
status string The action status. Can be created, assigned, started, completed, canceled, suspended
sub_status string Granular action status. Can be not_started, in_queue (for assigned status) leaving_now, on_the_way, arriving, arrived (for started status)
initial_eta ISO datetime string The initial eta calculated for the action
eta ISO datetime string The current eta for the action, calculated in real-time
completed_place JSON The place where the action was completed
completed_at ISO datetime string The time at which the action was completed
tracking_url string The URL at which this action can be tracked
created_at ISO datetime string Timestamp of when action was created
modified_at ISO datetime string Timestamp of when action was modified
distance double Distance travelled by the user

Create an Action

Creates a new action object.

HTTP Request

POST https://api.hypertrack.com/api/v1/actions/

Returns

Returns an action object if the call succeeded.

Parameters

Parameter Required Description
expected_place_id No The id of the Place where the action will be performed
expected_place No The Place object where the action will be performed. Only one of expected_place or expected_place_id must be specified.
type No The type of the action, possible values are pickup, delivery, dropoff, visit, stopover or task. Defaults to task.
lookup_id No An id that you can specify based on your internal ids
scheduled_at No The scheduled time by when the action should be completed
curl -H "Authorization: token YOUR_SK_TOKEN" \
     -H "Content-Type: application/json" \
     -X POST \
     -d "{\"expected_place_id\": \"f3ead2ae-dc0a-4a7e-85be-74ee51d9d70a\", \"scheduled_at\": \"2016-03-09T07:00:00.00Z\"}" \
     https://api.hypertrack.com/api/v1/actions/
hypertrack.Action.create(
    expected_place_id='f3ead2ae-dc0a-4a7e-85be-74ee51d9d70a',
    scheduled_at='2016-03-09T07:00:00.00Z'
)
HyperTrackClient client = new HyperTrackClient("YOUR_SK_TOKEN");
ActionFactory actionFactory = new ActionFactory(client);
Map<String, Object> params = new HashMap<>();
params.put("expected_place_id", "f3ead2ae-dc0a-4a7e-85be-74ee51d9d70a");
params.put("scheduled_at", "2016-03-09T07:00:00.00Z");
Action action = actionFactory.create(params);

Complete an Action

Completes an Action.

[warning] Completing actions

If marking actions is done using interactions in the mobile app, it is recommended to use the SDK methods for completing actions. This way the action has the right metadata for more accurate data collection.

HTTP Request

POST https://api.hypertrack.com/api/v1/actions/<id>/complete/

Returns

Returns an action object if the call succeeded.

Parameters

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

% sample lang="python" %}

action = hypertrack.Action.retrieve('ce2102c3-b411-4481-b13e-87559f2b441f')
action.complete()
HyperTrackClient client = new HyperTrackClient("YOUR_SK_TOKEN");
ActionFactory actionFactory = new ActionFactory(client);
Action action = actionFactory.retrieve("ce2102c3-b411-4481-b13e-87559f2b441f");
actionFactory.complete(action, null);

Cancel Action

Cancels an Action. Canceled actions cannot be reassigned, removed or completed.

HTTP Request

POST https://api.hypertrack.com/api/v1/actions/<id>/cancel/

Returns

Returns an action object if the call succeeded.

curl -H "Authorization: token YOUR_SK_TOKEN" \
     -H "Content-Type: application/json" \
     -X POST \
     https://api.hypertrack.com/api/v1/actions/77b9a3fa-a3ab-4840-aadb-cd33442ca45b/cancel/

% sample lang="python" %}

action = hypertrack.Action.retrieve('ce2102c3-b411-4481-b13e-87559f2b441f')
action.cancel()
HyperTrackClient client = new HyperTrackClient("YOUR_SK_TOKEN");
ActionFactory actionFactory = new ActionFactory(client);
Action action = actionFactory.retrieve("ce2102c3-b411-4481-b13e-87559f2b441f");
actionFactory.cancel(action, null);

Retrieve an Action

Retrieves an action object with the id.

HTTP Request

GET https://api.hypertrack.com/api/v1/actions/<id>/

Returns

Returns an action object if the call succeeded.

curl -H "Authorization: token YOUR_PK_TOKEN" \
     -H "Content-Type: application/json" \
     -X GET \
     https://api.hypertrack.com/api/v1/actions/77b9a3fa-a3ab-4840-aadb-cd33442ca45b/
action = hypertrack.Action.retrieve('ce2102c3-b411-4481-b13e-87559f2b441f')
HyperTrackClient client = new HyperTrackClient("YOUR_SK_TOKEN");
ActionFactory actionFactory = new ActionFactory(client);
Action action = actionFactory.retrieve("ce2102c3-b411-4481-b13e-87559f2b441f");

Meter an Action

Returns distance and duration traveled for the action. By default, this is from when the previous was completed or when the user went online.

HTTP Request

GET https://api.hypertrack.com/api/v1/actions/<id>/meter/

Returns

Returns an action object if the call succeeded.

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

List all Actions

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

HTTP Request

GET https://api.hypertrack.com/api/v1/actions/

Returns

Returns a list of actions.

Parameters

Parameter Required Description
page_size No Maximum number of objects to return, default is 50
user_id No Filter actions that are assigned to a user
lookup_id No Filter actions by lookup id
curl -H "Authorization: token YOUR_SK_TOKEN" \
     -X GET \
     https://api.hypertrack.com/api/v1/actions/?page_size=20

% sample lang="python" %}

actions = hypertrack.Action.list()

Delete an Action

Delete an existing action object.

HTTP Request

DELETE https://api.hypertrack.com/api/v1/actions/<id>/

Returns

Empty response if the object is deleted.

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

% sample lang="python" %}

action = hypertrack.Action.retrieve('ce2102c3-b411-4481-b13e-87559f2b441f')
action.delete()
HyperTrackClient client = new HyperTrackClient("YOUR_SK_TOKEN");
ActionFactory actionFactory = new ActionFactory(client);
Action action = actionFactory.retrieve("ce2102c3-b411-4481-b13e-87559f2b441f");
actionFactory.delete(action);

Was this helpful? Yes, thanks! Not really

results matching ""

    No results matching ""