Getting Started - Integrate the API

Now that you have live locations for your users, you would want to track actions that happen in your workflow. These actions can be your user making visits, pickups or deliveries. In this guide, we will create actions, assign them to your users, get ETAs and status updates, and live track them as they happen.

Step 1: Create an action

When you create a transaction that you want to track, create a corresponding Action object. You can optionally add additional information to the action.

Parameter Required Description
type No Defines what type of action it is. You can pick from one of the predefined values: pickup, delivery, dropoff, visit, stopover. The default is task.
lookup_id No Unique ID that you use in your system to uniquely identify and search for this action
expected_at No Expected time of the action, specified as an ISO 8601
expected_place No JSON field for the place
curl -H "Authorization: token YOUR_SK_TOKEN" \
     -H "Content-Type: application/json" \
     -X POST \
     -d "{\"expected_at\": \"2017-03-09T07:00:00.00Z\"}" \
     https://api.hypertrack.com/api/v1/actions/

Example response

{
  "id": "abe3adf3-a2c0-40cb-8c32-b2988f997ca1",
  "user": null,
  "type": "task",
  "expected_place": null,
  "expected_at": "2017-03-09T07:00:00.00Z",
  "completed_place": null,
  "completed_at": null,
  "assigned_at": null,
  "started_at": null,
  "status": "created",
  "eta": null,
  "initial_eta": null,
  "tracking_url": "http://eta.fyi/z3v3hS",
  "lookup_id": "",
  "created_at": "2017-03-06T05:59:33.033114Z",
  "modified_at": "2017-03-06T05:59:33.033143Z",
  "display": {
    "status_text": "Created",
    "sub_status_text": ""
  }
}

Step 2: Create a user

In case you have created a user object from the SDK, you can skip this step, and just use the same id that was created. If not, you can create users using an API call, and then send their id to the SDK.

When creating users, you can optionally add additional information.

Parameter Required Description
name No Name of the user
phone No E164 formatted phone number of the user
photo No A photo file of the user. You can upload the image file via the HTTP multipart/form-data standard, or include a publicly-accessible image link.
lookup_id No Unique ID that you use in your system to uniquely identify and search for this user
group_id No Identifier of the group to which the user belongs
curl -H "Authorization: token YOUR_SK_TOKEN" \
     -H "Content-Type: application/json" \
     -X POST \
     -d "{\"name\": \"John Doe\"}" \
     https://api.hypertrack.com/api/v1/users/

Example response

{
  "id": "1b7d2def-741e-4c07-a90d-61ab665356ca",
  "group_id": null,
  "lookup_id": null,
  "name": "John Doe",
  "phone": null,
  "photo": null,
  "availability_status": "offline",
  "last_location": {},
  "last_online_at": null,
  "display": {
    "status_text": "Offline",
    "sub_status_text": ""
  },
  "created_at": "2017-03-06T06:36:58.328323Z",
  "modified_at": "2017-03-06T06:36:58.328354Z"
}

Step 3: Assign the action to a user

When you assign the action to a user in your backend or app, call our corresponding API.

  • You can assign multiple actions at a time to a user
  • You can let us know the order in which you expect these actions to be completed, in case you know that order beforehand
  • You can assign actions to an active user as well (active user means the user has been assigned actions that are pending)

[info] SDK tracking

Ensure the SDK is enabled at this point, with the startTracking method.

curl -H "Authorization: token YOUR_SK_TOKEN" \
     -H "Content-Type: application/json" \
     -X POST \
     -d "{\"action_ids\": [\"abe3adf3-a2c0-40cb-8c32-b2988f997ca1\"]}" \
     https://api.hypertrack.com/api/v1/users/1b7d2def-741e-4c07-a90d-61ab665356ca/assign_actions/

Step 4: Live track the action

Now that you have actions assigned to a user, you can start live tracking the action.

  • For every action that you create, you get a unique tracking trck.at URL that you can share directly with any of your users.
  • You can track these actions on the live dashboard by going to Actions tab. Click on the specific action to see more details of the actions, and replay the action.

Step 5: Complete the action

When the action is marked complete in your backend or on your app, call our API to complete the Action. When you complete the action, we capture the actual place and time of the user when it happened, so as to compare with the expected place and time.

curl -H "Authorization: token YOUR_SK_TOKEN" \
     -H "Content-Type: application/json" \
     -X POST \
     https://api.hypertrack.com/api/v1/actions/abe3adf3-a2c0-40cb-8c32-b2988f997ca1/complete/

results matching ""

    No results matching ""