Event

Events are our way of letting you know when something interesting happens in your account. When an interesting event occurs, we create a new Event object. For example, when an action is completed, we create a action.completed event. When a trip ends, we create a trip.ended event.

Like our other API resources, you can retrieve an individual event or a list of events from the API. We also have a system for sending the events directly to your server, called webhooks.

The Event object

Property Type Description
id uuid string Unique identifier for the object
user_id uuid string Identifier for the user object to which the event belongs
type string Description of the event, e.g. trip.ended, task.completed. More types listed below.
recorded_at ISO datetime string Timestamp of when the event occurred
data JSON JSON containing data associated with the event
has_been_delivered boolean Indicates whether the event was delivered via webhook or not
delivered_at ISO datetime string Timestamp of when the event was delivered via webhook
created_at ISO datetime string Timestamp of when the event was created

Event types

This is a list of all the types of events we currently send. You'll notice that these events follow a pattern, resource.event. Our goal is to design a consistent system that makes things easier to anticipate and code against.

User events

These events describe a User.

Event type Description
user.created Occurs when a user is created
tracking.started Occurs when the user goes online and tracking is started
tracking.ended Occurs when the user goes offline and tracking is ended
trip.started Occurs when the user is moving and starting a trip
trip.ended Occurs when the user has stopped moving
stop.started Occurs when the user is making a stop
stop.ended Occurs when the user is moving after making a stop

Action events

These events describe a Action.

Event type Description
action.assigned Occurs when an action is assigned to a user
action.delayed Occurs when we detect an action is going to be completed later than the expectation
action.completed Occurs when the action has been completed

Retrieve a Event

This API retrieves the details of an event. Supply the unique identifier of the event, which you might have received in a webhook. All events share a common structure, detailed below. The only property that will differ is the data property.

In each case, the data dictionary will have an attribute called object and its value will be the same as retrieving the same object directly from the API. For example, a order.created event will have the same information as retrieving the relevant order would.

HTTP Request

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

Returns

Returns an event object if a valid identifier was provided.

curl "https://app.hypertrack.io/api/v1/events/e686fe05-b64d-464d-a4e5-c65e278c1bf1/"
  -H "Authorization: token YOUR_SK_TOKEN"

Example response

{
  "id":"6d6e827c-93ab-492c-a2c3-5c5fef9312fe",
  "event_type":"task.completed",
  "event_reason":null,
  "data":{
    "object":{
      "id":"41caa9f2-ad63-4a8b-98ed-1414c372e1ce",
      "driver_id":"d0ae4912-2074-45ef-a7c0-76be58639ea9",
      "is_live":false,
      "initial_eta":"2016-03-09T07:28:40.601013Z",
      "eta":"2016-03-09T07:28:40.601013Z",
      "start_location":{
        "type":"Point",
        "coordinates":[
          -122.420044,
          37.774543
        ]
      },
      "end_location":{
        "type":"Point",
        "coordinates":[
          -122.402248,
          37.78929
        ]
      },
      "started_at":"2016-03-09T07:13:05.026689Z",
      "ended_at":"2016-03-09T09:06:39.073770Z",
      "distance":0,
      "encoded_polyline":"",
      "tasks":[
        "77b9a3fa-a3ab-4840-aadb-cd33442ca45b"
      ],
      "vehicle_type":"",
      "created_at":"2016-03-09T07:13:05.026316Z",
      "modified_at":"2016-03-09T09:06:39.079374Z"
    }
  },
  "event_time":"2016-03-09T22:39:18.950318Z",
  "created_at":"2016-03-09T22:39:18.950318Z",
  "modified_at":"2016-03-09T22:39:18.950457Z"
}

results matching ""

    No results matching ""