### Create Ops Group via HyperTrack API Source: https://developer.hypertrack.com/docs/worker-setup This example demonstrates how to create an Ops Group using the HyperTrack API. Ops Groups are used to segment your fleet based on operational divisions or business units. The request body includes an `ops_group_handle`, `ops_group_label`, and `timezone`. ```json { "ops_group_handle": "b-unit-1533", "ops_group_label": "Business Unit", "timezone": "America/Los_Angeles" } ``` -------------------------------- ### Example URL for Customizable End Customer View Source: https://developer.hypertrack.com/docs/trckat-view This example demonstrates how to construct a shareable URL for the end customer view. It shows how to append query parameters to customize text displayed for different order stages. No specific dependencies are required, as it's a URL format. ```url https://trck.at/MqkZ8kGBvy?enroute_stage_text=Shift%20pending&start_stage_text=Shift%20started ``` -------------------------------- ### POST /orders-track (On-Shift Tracking) Source: https://developer.hypertrack.com/docs/shift-tracking This endpoint is used to track on-shift risks. It is recommended to start tracking approximately 30 minutes before the shift begins. Key parameters include `order_handle` for linking shifts, `scheduled_at` for shift start time, `expected_service_time` for shift duration, and `track_mode` set to 'on_shift' for geofence tracking. ```APIDOC ## POST /orders-track ### Description Initiates on-shift tracking for a worker. This endpoint allows for monitoring worker activities during their scheduled shift, including geofence entries and exits. ### Method POST ### Endpoint /orders-track ### Parameters #### Query Parameters None #### Request Body - **ops_group_handle** (string) - Required - The handle for the operations group. - **track_mode** (string) - Required - Specifies the tracking mode. For on-shift tracking, use 'on_shift'. - **worker_handle** (string) - Required - The unique identifier for the worker. - **orders** (array) - Required - A list of orders to track. - **order_handle** (string) - Required - A unique identifier for the order (shift). - **destination** (object) - Required - The destination for the order. - **address** (string) - Optional - The address of the destination. - **geometry** (object) - Required - The geographic coordinates of the destination. - **type** (string) - Required - The type of geometry (e.g., 'Point'). - **coordinates** (array) - Required - An array containing longitude and latitude. - **scheduled_at** (string) - Optional - The scheduled start time of the shift in ISO 8601 format. - **expected_service_time** (integer) - Optional - The expected duration of the service in seconds. ### Request Example ```json { "ops_group_handle": "default", "track_mode": "on_shift", "worker_handle": "david@ht.com", "orders": [ { "order_handle": "shift-2", "destination": { "address": "4501 Rosewood Dr, Pleasanton, CA 94588", "geometry":{ "type": "Point", "coordinates": [-121.889965, 37.6982982] } }, "expected_service_time": 10800 } ] } ``` ### Response #### Success Response (200) - **status** (string) - The status of the request. - **message** (string) - A message indicating the result of the operation. - **orders** (array) - Details of the processed orders. #### Response Example ```json { "status": "success", "message": "Orders processed successfully.", "orders": [ { "order_handle": "shift-2", "status": "created" } ] } ``` ``` -------------------------------- ### Install HyperTrack SDK for Ionic Capacitor Source: https://developer.hypertrack.com/docs/install-sdk-ionic-capacitor Installs the HyperTrack SDK package for Ionic Capacitor projects using npm. This is the initial step for integrating HyperTrack into your application. ```bash npm install hypertrack-sdk-ionic-capacitor ``` -------------------------------- ### Install HyperTrack SDK for React Native Source: https://developer.hypertrack.com/docs/install-sdk-react-native.md Installs the main HyperTrack SDK and necessary Android plugins for React Native applications using npm. Ensure all plugins match the main SDK version. ```bash npm install hypertrack-sdk-react-native \ hypertrack-sdk-react-native-plugin-android-location-services-google \ hypertrack-sdk-react-native-plugin-android-activity-service-google \ hypertrack-sdk-react-native-plugin-android-push-service-firebase ``` -------------------------------- ### Invite Workers via API Source: https://developer.hypertrack.com/docs/distribute-orders-app Generates a personalized deep link for workers to install the Orders App. Use a unique worker identifier as the `worker_handle` to create a unique invitation link. ```APIDOC ## POST /workers/{worker_handle}/invite ### Description This endpoint generates a personalized deep link for workers to install the HyperTrack Orders App. The `worker_handle` is a unique identifier for your worker. ### Method POST ### Endpoint `https://v3.api.hypertrack.com/{worker_handle}/invite` ### Parameters #### Path Parameters - **worker_handle** (string) - Required - A unique identifier for the worker. ### Request Example ```json { "worker_handle": "worker_foo_1" } ``` ### Response #### Success Response (200) - **worker_handle** (string) - The unique identifier of the worker. - **invite_link** (string) - A deep link URL that can be shared with the worker to install the Orders App. #### Response Example ```json [ { "worker_handle": "worker_foo_1", "invite_link": "https://hypertrack-orders.app.link/wqepoifv8f34c" } ] ``` ``` -------------------------------- ### Example Webhook Payload Structure Source: https://developer.hypertrack.com/docs/stream-order-activity-markers-via-webhooks This is an example of a webhook payload structure that HyperTrack sends for location data. It includes details about the recorded event, device information, and location coordinates. Developers can use this structure to anticipate and parse incoming data. ```json [ { "recorded_at": "2019-02-27T22:50:24.538000Z", "data": { "altitude": 495.2, "bearing": 90, "location": { "coordinates": [ -6.2755, 57.6398983 ], "type": "Point" }, "location_accuracy": 14.087, "speed": 0 }, "device_id": "TEST_DEVICE_ID", "type": "location", "account_id": "0" } ] ``` -------------------------------- ### Install HyperTrack SDK Dependencies (Bash) Source: https://developer.hypertrack.com/docs/install-sdk-expo Installs the necessary HyperTrack SDK packages for Expo and React Native, including specific Android plugins for location and activity services, and Firebase push notifications. ```bash npx expo install hypertrack-sdk-expo \ hypertrack-sdk-react-native \ hypertrack-sdk-react-native-plugin-android-location-services-google \ hypertrack-sdk-react-native-plugin-android-activity-service-google \ hypertrack-sdk-react-native-plugin-android-push-service-firebase ``` -------------------------------- ### GET /orders/{order_handle} (Retrieve Shift Timeline) Source: https://developer.hypertrack.com/docs/shift-tracking Retrieves the full timeline for a specific order (shift) using its unique `order_handle`. This provides a detailed history of the worker's activities during the shift. For real-time updates, webhooks are recommended. ```APIDOC ## GET /orders/{order_handle} ### Description Retrieves the complete timeline data for a given order, identified by its `order_handle`. This includes all events, locations, and status updates related to the order's lifecycle. ### Method GET ### Endpoint /orders/{order_handle} ### Parameters #### Path Parameters - **order_handle** (string) - Required - The unique identifier of the order (shift) to retrieve the timeline for. #### Query Parameters None ### Response #### Success Response (200) - **order_handle** (string) - The identifier of the order. - **timeline** (array) - An array of timeline events, each containing details like timestamp, location, and event type. - **status** (string) - The current status of the order. #### Response Example ```json { "order_handle": "shift-2", "timeline": [ { "timestamp": "2025-01-21T23:05:00Z", "event": "created", "location": { "lat": 37.6982982, "lng": -121.889965 } }, { "timestamp": "2025-01-21T23:10:00Z", "event": "geofence_enter", "geofence_id": "destination-geofence-id", "location": { "lat": 37.6982982, "lng": -121.889965 } } ], "status": "in_progress" } ``` ``` -------------------------------- ### GET /websites/developer_hypertrack Source: https://developer.hypertrack.com/docs/migrate-from-tripv2-to-order-api Retrieves detailed information about a specific website project, including summary data for devices associated with it. ```APIDOC ## GET /websites/developer_hypertrack ### Description Retrieves detailed information about a specific website project, including summary data for devices associated with it. This endpoint provides insights into device locations, status changes, and associated geofence data. ### Method GET ### Endpoint /websites/developer_hypertrack ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **duration_at_destination** (float) - The duration spent at the destination. - **summary** (object) - Contains a summary of the device's activity. - **device_id** (string) - The unique identifier for the device. - **locations** (object) - Represents the geographical path of the device. - **type** (string) - The GeoJSON type, expected to be 'LineString'. - **coordinates** (array) - An array of coordinate points, each containing [longitude, latitude, altitude, timestamp]. - **markers** (array) - A list of significant events or status changes for the device. - **type** (string) - The type of marker (e.g., 'device_status'). - **data** (object) - Data associated with the marker. - **start** (object) - Information about the start of an event. - **recorded_at** (string) - Timestamp when the event started. - **location** (object) - Location data at the start of the event. - **recorded_at** (string) - Timestamp of the recorded location. - **geometry** (object) - GeoJSON geometry of the location. - **type** (string) - GeoJSON geometry type, expected to be 'Point'. - **coordinates** (array) - [longitude, latitude] of the location. - **end** (object) - Information about the end of an event. - **recorded_at** (string) - Timestamp when the event ended. - **location** (object) - Location data at the end of the event. - **recorded_at** (string) - Timestamp of the recorded location. - **geometry** (object) - GeoJSON geometry of the location. - **type** (string) - GeoJSON geometry type, expected to be 'Point'. - **coordinates** (array) - [longitude, latitude] of the location. - **duration** (integer) - Duration of the event in seconds. - **value** (string) - The status value (e.g., 'inactive', 'active'). - **reason** (string, optional) - Reason for the status change (e.g., 'tracking_service_terminated'). - **address** (string, optional) - Human-readable address associated with the event. - **activity** (string, optional) - Type of activity detected (e.g., 'stop'). - **steps** (integer, optional) - Number of steps detected. - **bubble** (object, optional) - Information about a detected bubble. - **centroid** (array) - [longitude, latitude] of the bubble's centroid. - **radius** (integer) - Radius of the bubble. - **arrival** (object, optional) - Information about an arrival event. - **location** (object) - Location data at arrival. - **geometry** (object) - GeoJSON geometry of the arrival location. - **type** (string) - GeoJSON geometry type, expected to be 'Point'. - **coordinates** (array) - [longitude, latitude, altitude] of the arrival location. - **recorded_at** (string) - Timestamp of the arrival. - **geofence** (object, optional) - Information about a geofence. - **geometry** (object) - GeoJSON geometry of the geofence. - **type** (string) - GeoJSON geometry type (e.g., 'Point'). - **coordinates** (array) - [longitude, latitude] of the geofence center. - **geofence_id** (string) - Unique identifier for the geofence. - **radius** (integer) - Radius of the geofence. - **marker_id** (string) - Unique identifier for the marker. #### Response Example ```json { "duration_at_destination": 3264.0, "summary": { "device_id": "5F9C5400-5732-4A02-B3DC-A5E06EE29901", "locations": { "type": "LineString", "coordinates": [ [ -98.285827, 29.596968, 219.35, "2024-09-19T16:42:31.082Z" ], [ -98.285672, 29.59711, 219.7, "2024-09-19T16:45:23.245Z" ], [ -98.285705, 29.597097, 219.52, "2024-09-19T16:45:23.245Z" ] ] }, "markers": [ { "type": "device_status", "data": { "start": { "recorded_at": "2024-09-19T15:46:01.962Z", "location": { "recorded_at": "2024-09-19T16:16:13.059Z", "geometry": { "type": "Point", "coordinates": [ -98.28559, 29.597195 ] } } }, "end": { "recorded_at": "2024-09-19T16:16:13.059Z", "location": { "recorded_at": "2024-09-19T16:16:13.059Z", "geometry": { "type": "Point", "coordinates": [ -98.28559, 29.597195 ] } } }, "duration": 1811, "value": "inactive", "reason": "tracking_service_terminated" }, "marker_id": "8e122ee6-8dww-4139-96fc-5d18903308e8" }, { "type": "device_status", "data": { "start": { "recorded_at": "2024-09-19T16:16:13.059Z", "location": { "recorded_at": "2024-09-19T16:16:13.059Z", "geometry": { "type": "Point", "coordinates": [ -98.28559, 29.597195 ] } } }, "end": { "recorded_at": "2024-09-19T17:10:36.583Z", "location": { "geometry": { "type": "Point", "coordinates": [ -98.285672, 29.59711 ] }, "recorded_at": "2024-09-19T16:45:23.245Z" } }, "duration": 3264, "value": "active", "address": "Mid-Cities Parkway, Schertz, Guadalupe County, Texas, 78154, United States", "activity": "stop", "steps": 0, "bubble": { "centroid": [ -98.285855, 29.59711 ], "radius": 148 } }, "marker_id": "67f31580-h433-46a9-ab60-9674149b4c99" }, { "data": { "arrival": { "location": { "geometry": { "coordinates": [ -98.28559, 29.597195, 0 ], "type": "Point" }, "recorded_at": "2024-09-19T16:16:13.059Z" } }, "geofence": { "geometry": { "type": "Point", "coordinates": [ -98.2858361, 29.5979442 ] }, "geofence_id": "f602abb9-2f5f-4bb7-97d5-8ed336c8a119", "radius": 450 } } } ] } } ``` ``` -------------------------------- ### Create a Worker Source: https://developer.hypertrack.com/docs/worker-setup This endpoint allows you to create a new worker in HyperTrack. Workers can be associated with an ops group for better fleet management. Note that the `worker_handle` must also be set in the app for the device to connect to this worker. ```APIDOC ## POST /workers ### Description Creates a new worker profile in HyperTrack. This worker can be optionally associated with an existing ops group. ### Method POST ### Endpoint `https://v3.api.hypertrack.com/workers` ### Parameters #### Request Body - **worker_handle** (string) - Required - An internal identifier for the worker (e.g., user ID, email). - **name** (string) - Required - The name of the worker. - **profile** (object) - Optional - Additional profile information for the worker. - **worker_id** (string) - Optional - A custom worker ID. - **region_id** (number) - Optional - The ID of the region the worker belongs to. - **manager_id** (string) - Optional - The ID of the manager overseeing the worker. - **ops_group_handle** (string) - Optional - The handle of the ops group this worker belongs to. ### Request Example ```json { "worker_handle": "james@ht.com", "name": "James", "profile": { "worker_id": "144223", "region_id": 1, "manager_id": "m-52552" }, "ops_group_handle": "b-unit-1533" } ``` ### Response #### Success Response (200) - **created_at** (string) - The timestamp when the worker was created. - **worker_handle** (string) - The unique handle of the worker. - **name** (string) - The name of the worker. - **profile** (object) - Profile details of the worker. - **worker_id** (string) - Custom worker ID. - **region_id** (number) - Region ID. - **manager_id** (string) - Manager ID. - **ops_group_handle** (string) - The handle of the ops group the worker belongs to. #### Response Example ```json { "created_at": "2024-01-01T13:45:00Z", "worker_handle": "james@ht.com", "name": "James", "profile": { "worker_id": "144223", "region_id": 1, "manager_id": "m-52552" }, "ops_group_handle": "b-unit-1533" } ``` ``` -------------------------------- ### Get Geotag Distances in Real-time via Webhooks Source: https://developer.hypertrack.com/docs/stream-order-activity-markers-via-webhooks This webhook payload provides real-time geotag data, including route information such as distance in meters, duration in seconds, start location, and recorded timestamp. It also includes the location captured by HyperTrack when an app event is generated. This data is crucial for tracking user movement and calculating travel metrics. ```shell { "created_at": "2019-07-01T14:01:00.000000Z", "recorded_at": "2019-07-01T14:00:00.000000Z", "data": { "metadata": { "Route type": "Car", "Station Id": "1BCX", "Package Id": "1WUXZ1393", "Route Id": "2248311", "Action Type": "Reached Doorstep" }, "route_to":{ "distance": 238, "duration": 63, "start_location": { "geometry": { "coordinates": [ -6.271, 57.6398983 ], "type": "Point" }, "recorded_at": "2019-07-01T13:52:08.213000Z" } } }, "location": { "type": "Point", "coordinates": [ -6.2755, 57.6398983 ] }, "device_id": "00112233-4455-6677-8899-AABBCCDDEEFF", "type": "geotag", "version": "2.0.0" } ``` -------------------------------- ### Pre-shift Tracking with HyperTrack Orders API Source: https://developer.hypertrack.com/docs/shift-tracking This snippet demonstrates how to configure the HyperTrack Orders API for pre-shift tracking. It includes essential parameters like `ops_group_handle`, `track_mode`, `worker_handle`, `order_handle`, `destination`, and `scheduled_at`. This setup is useful for initiating tracking before a shift begins. ```javascript { "ops_group_handle": "default", "track_mode": "pre_shift", "worker_handle": "david@ht.com", "orders": [ { "order_handle": "shift-1", "destination": { "address": "4501 Rosewood Dr, Pleasanton, CA 94588", "geometry":{ "type": "Point", "coordinates": [-121.889965, 37.6982982] } }, "scheduled_at": "2025-01-21T23:00:00Z" } ] } ``` -------------------------------- ### Create Worker via HyperTrack API Source: https://developer.hypertrack.com/docs/worker-setup This JSON snippet illustrates how to create a worker profile using the HyperTrack API. It includes essential worker details such as `worker_handle`, `name`, `profile` information (like `worker_id`, `region_id`, `manager_id`), and the `ops_group_handle` to associate the worker with a specific group. ```json { "worker_handle": "james@ht.com", "name": "James", "profile": { "worker_id": "144223", "region_id": 1, "manager_id": "m-52552" }, "ops_group_handle": "b-unit-1533" } ``` -------------------------------- ### Manual AppDelegate Integration for Hypertrack SDK (Swift) Source: https://developer.hypertrack.com/docs/ios-sdk-faq Provides the necessary Swift code to manually integrate the Hypertrack SDK with AppDelegate methods when method swizzling is disabled. This includes handling app launch and remote notifications. ```swift class CustomAppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { HyperTrack.didFinishLaunchingWithOptions(launchOptions) return true } func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) { HyperTrack.didFailToRegisterForRemoteNotificationsWithError(error) } func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { HyperTrack.didReceiveRemoteNotification(userInfo, fetchCompletionHandler: completionHandler) } func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { HyperTrack.didRegisterForRemoteNotificationsWithDeviceToken(deviceToken) } } ``` -------------------------------- ### Install Native iOS SDK via CocoaPods Source: https://developer.hypertrack.com/docs/install-sdk-ionic-capacitor Installs the native HyperTrack SDK for iOS within your Ionic Capacitor project's iOS directory using CocoaPods. This ensures native iOS functionality is available. ```bash cd ios pod install ``` -------------------------------- ### Full-shift Tracking with HyperTrack Orders API Source: https://developer.hypertrack.com/docs/shift-tracking This JavaScript snippet shows how to set up the HyperTrack Orders API for full-shift tracking. It utilizes parameters such as `ops_group_handle`, `track_mode` as 'full_shift', `worker_handle`, `order_handle`, `destination`, `scheduled_at`, and `expected_service_time`. This configuration covers the entire duration of a shift. ```javascript { "ops_group_handle": "default", "track_mode": "full_shift", "worker_handle": "david@ht.com", "orders": [ { "order_handle": "shift-3", "destination": { "address": "4501 Rosewood Dr, Pleasanton, CA 94588", "geometry":{ "type": "Point", "coordinates": [-121.889965, 37.6982982] } }, "scheduled_at": "2025-01-21T23:00:00Z", "expected_service_time": 10800 } ] } ``` -------------------------------- ### On-shift Tracking with HyperTrack Orders API Source: https://developer.hypertrack.com/docs/shift-tracking This code sample illustrates the configuration for on-shift tracking using the HyperTrack Orders API. Key parameters include `ops_group_handle`, `track_mode` set to 'on_shift', `worker_handle`, `order_handle`, `destination`, and `expected_service_time`. This is ideal for tracking activities during an active shift. ```javascript { "ops_group_handle": "default", "track_mode": "on_shift", "worker_handle": "david@ht.com", "orders": [ { "order_handle": "shift-2", "destination": { "address": "4501 Rosewood Dr, Pleasanton, CA 94588", "geometry":{ "type": "Point", "coordinates": [-121.889965, 37.6982982] } }, "expected_service_time": 10800 } ] } ``` -------------------------------- ### Order Details API Response (GET /orders/{order_handle}) Source: https://developer.hypertrack.com/docs/migrate-from-tripv2-to-order-api This JSON response details an order fetched using the GET /orders/{order_handle} endpoint. It provides timestamps for various order states, capacity utilization, destination information including check-ins and parkings, and route geometry. ```json { "actual_service_time": 29673, "arrived_at": "2024-07-21T00:34:38.434Z", "assigned_at": "2024-07-20T22:00:09.565Z", "capacity_used": 1, "completed_at": "2024-07-21T11:30:04.930Z", "completed_at_destination": false, "created_at": "2024-07-20T22:00:09.251Z", "destination": { "address": "Golden Living Convalescent Center, Blake Street, Edwardsville, Wyandotte County, Kansas, 66113, United States", "checkins": [ { "count": 1, "geometry": { "coordinates": [ -94.80620346228154, 39.060786031602774 ], "type": "Point" }, "score": 23.019083333333334, "source": "ht-generated" } ], "completions": [], "geometry": { "coordinates": [ -94.8168704, 39.0563257 ], "type": "Point" }, "parkings": [ { "count": 2, "geometry": { "coordinates": [ -94.81645520590858, 39.056779680098245 ], "type": "Point" }, "score": 56.55160916467568, "source": "ht-generated" } ], "radius": 402, "service_areas": [ { "geometry": { "coordinates": [ [ [ -94.81642054303121, 39.05598781701963 ] ] ], "type": "Polygon" }, "inclusivity": "10", "source": "ht-generated" }, { "geometry": { "coordinates": [ [ [ -94.81642054303121, 39.05598781701963 ] ] ], "type": "Polygon" }, "inclusivity": "25", "source": "ht-generated" }, { "geometry": { "coordinates": [ [ [ -94.81610705387665, 39.0564284445123 ], [ -94.81642054303121, 39.05598781701963 ] ] ], "type": "Polygon" }, "inclusivity": "50", "source": "ht-generated" }, { "geometry": { "coordinates": [ [ [ -94.81642054303121, 39.05598781701963 ] ] ], "type": "Polygon" }, "inclusivity": "75", "source": "ht-generated" }, { "geometry": { "coordinates": [ [ [ -94.81642054303121, 39.05598781701963 ], [ -94.81642054303121, 39.05598781701963 ] ] ], "type": "Polygon" } } ] } } ``` -------------------------------- ### Get Order Data Source: https://developer.hypertrack.com/docs/tripsv1-to-orders-api Endpoints for retrieving details and analytics for orders. ```APIDOC ## GET /orders/{order_handle} ### Description Retrieves the details of a single order. This endpoint replaces GET /trips/{trip_id}. ### Method GET ### Endpoint /orders/{order_handle} ### Parameters #### Path Parameters - **order_handle** (string) - Required - The business identifier of the order to retrieve. ### Response #### Success Response (200) - **order_details** (object) - Contains the details of the order. #### Response Example ```json { "order_details": { "order_handle": "order-1", "status": "in_progress", "scheduled_at": "2024-02-26T01:30:00Z", "destination": { "place_handle": "apple_park" } } } ``` ## GET /orders ### Description Retrieves a list of all orders with optional filtering. This endpoint replaces GET /trips. ### Method GET ### Endpoint /orders ### Parameters #### Query Parameters - **status** (string) - Optional - Filter orders by their status. - **scheduled_after** (string) - Optional - Filter orders scheduled after a specific time. ### Response #### Success Response (200) - **orders** (array) - A list of order objects. #### Response Example ```json { "orders": [ { "order_handle": "order-1", "status": "in_progress" }, { "order_handle": "order-2", "status": "completed" } ] } ``` ## GET /orders/{order_handle}/analytics ### Description Retrieves analytics data for a specific order, including tracking duration and rate. This endpoint replaces GET /trips/{trip_id}/analytics. ### Method GET ### Endpoint /orders/{order_handle}/analytics ### Parameters #### Path Parameters - **order_handle** (string) - Required - The business identifier of the order to get analytics for. ### Response #### Success Response (200) - **analytics_data** (object) - Contains the analytics for the order. #### Response Example ```json { "analytics_data": { "active_duration_at_destination": "600s", "tracking_rate": "0.95", "active_duration": "3600s", "total_duration": "3700s" } } ``` ``` -------------------------------- ### Get Worker Timeline Source: https://developer.hypertrack.com/docs/worker-device-linking Retrieve a worker's timeline, which seamlessly weaves together multiple device events into a single, coherent history. ```APIDOC ## GET /workers/{worker_handle} ### Description Retrieves the timeline of a specific worker, consolidating events from potentially multiple devices. ### Method GET ### Endpoint /workers/{worker_handle} ### Parameters #### Path Parameters - **worker_handle** (string) - Required - The unique identifier for the worker. ### Response #### Success Response (200) - **events** (array) - A list of events associated with the worker's timeline. - **device_id** (string) - The ID of the device associated with the event. - **timestamp** (string) - The timestamp of the event. #### Response Example ```json { "events": [ { "device_id": "device_abc", "timestamp": "2023-10-27T10:00:00Z" }, { "device_id": "device_xyz", "timestamp": "2023-10-27T11:00:00Z" } ] } ``` ``` -------------------------------- ### Constructing Embed URL with Driver State Source: https://developer.hypertrack.com/docs/workers-ops-views This example demonstrates how to construct a Hypertrack embed URL, incorporating a driver-state parameter. The driver-state is a Base64 encoded JSON string, which is further URI encoded for safe inclusion in a URL. This allows for dynamic configuration of the driver view. ```javascript let obj = {"ops_groups": ["test-ops-group", "b33ed748-e17f-4d93-905d-7238837736c6"], "tracking": true} let urlEncodedStateString = encodeURIComponent(btoa(JSON.stringify(obj))) // B64 encoding followed by URI encoding console.log(urlEncodedStateString) // The value below can then be passed as the value of the `driver-list-state` query param. // eyJvcHNfZ3JvdXBzIjpbInBiLXRlc3RpbmciLCJiMjdlZDc0OC1lMTdmLTRkOTMtOTA1ZC03MjM4ODM3NzM2YzYiXSwidHJhY2tpbmciOiJ0cnVlIn0%3D ``` -------------------------------- ### GET /websites/developer_hypertrack Source: https://developer.hypertrack.com/docs/migrate-from-tripv2-to-order-api Retrieves details about the developer's HyperTrack website, including associated routes and destination information. ```APIDOC ## GET /websites/developer_hypertrack ### Description Retrieves details about the developer's HyperTrack website, including associated routes and destination information. This endpoint provides comprehensive data about a specific website configuration within the HyperTrack system. ### Method GET ### Endpoint /websites/developer_hypertrack ### Parameters #### Query Parameters - **pagination_token** (string) - Optional - Token for paginating results. ### Request Example ``` GET /websites/developer_hypertrack?pagination_token=___eyJhY2NvdW50X2lkFs44w0kNzhkLWNkZGItNDQ2NS05ZjJhLTAyMTdjZTk4NmM0MyIsICJ0cmlwX2lkIjogImE0ZTdlZDE4LWNhYTMtNDRhOS1hNTA2LWM4NWIyKWWEm036882ICJzdGFydGVkX2F0IjogIjIwMjQtMDktMTlUMTQ6MzFqoSSQ12CCD ``` ### Response #### Success Response (200) - **destination** (object) - Information about the destination, including IDs, geofencing details, timestamps, addresses, geometry, share URLs, metadata, estimates, and radius. - **capacity** (integer) - The capacity associated with the destination or trip. - **optimise_route** (boolean) - Indicates if route optimization is enabled. - **flexible_route** (boolean) - Indicates if the route is flexible. - **vehicle_type** (string) - The type of vehicle used for the route. - **timezone** (string) - The timezone of the location. - **pagination_token** (string) - Token for paginating subsequent results. - **links** (object) - Links to related resources or actions. #### Response Example ```json { "destination": { "destination_id": "order-1", "trip_id": "335f0424-4987-427f-abe1-f9bd5764bb11", "geofence_id": "840674d5-959e-4823-a249-f6aa54bc408a", "delayed": true, "arrived": true, "arrived_at": "2024-09-19T16:16:13.059Z", "exited_at": "2024-09-19T17:10:37.148Z", "scheduled_at": "2024-09-19T16:30:00.000Z", "address": "5500 Mid Cities Parkway, Schertz, TX 78154", "geometry": { "type": "Point", "coordinates": [ -98.2858361, 29.5979442 ] }, "share_url": "https://trck.at/2Fs4tTy3da", "metadata": { "name": "James Smith", "worker_type": "shift", "shift": "shift-1", "worker_id": "james@ht.com" }, "estimate": { "number_of_reroutes": 22, "number_of_traffic_refreshes": 10, "traffic_time_per_meter": 0, "route": { "distance": 12000, "duration": 3600, "updated_at": "2024-09-19T16:21:27.438Z", "last_sent_duration": 7, "latest_processed_step_index": 15, "latest_processed_waypoint_index": 0, "remaining_distance": 4, "remaining_duration": 7, "polyline": { "type": "LineString", "coordinates": [ [ -98.28582, 29.59683 ], [ -98.28563, 29.59693 ], [ -98.28563, 29.59693 ], [ -98.28619, 29.59777 ], [ -98.28619, 29.59777 ] ] } }, "arrive_at": "2024-09-19T18:02:52.846Z" }, "radius": 450, "capacity": 1, "end_address": "Mid-Cities Parkway, Schertz, Guadalupe County, Texas, 78154, United States", "end_location": { "type": "Point", "coordinates": [ -98.285672, 29.59711 ] }, "device_id": "5F9C5400-5732-4A02-B3DC-A5E06EE29901", "duration_at_destination": 3264.0 }, "capacity": 10, "optimise_route": false, "flexible_route": false, "vehicle_type": "car", "timezone": "America/Chicago", "pagination_token": "___eyJhY2NvdW50X2lkFs44w0kNzhkLWNkZGItNDQ2NS05ZjJhLTAyMTdjZTk4NmM0MyIsICJ0cmlwX2lkIjogImE0ZTdlZDE4LWNhYTMtNDRhOS1hNTA2LWM4NWIyKWWEm036882ICJzdGFydGVkX2F0IjogIjIwMjQtMDktMTlUMTQ6MzFqoSSQ12CCD", "links": {} } ``` ``` -------------------------------- ### ETA Change Reason Explanation Source: https://developer.hypertrack.com/docs/stream-order-activity-markers-via-webhooks Explains the possible values for the `change_reason` field in an `eta_change` webhook, helping to understand why an ETA was recalculated. ```APIDOC ## ETA Change Reason ### Description When an `eta_change` order webhook is received, the `change_reason` field clarifies why the Estimated Time of Arrival (ETA) was recalculated. This helps differentiate between normal progress updates, traffic fluctuations, and route recalculations. ### Possible Values for `change_reason` - **`position_update`**: ETA recalculated based on the worker's new position. This indicates normal progress along the route. - **`traffic_update`**: ETA adjusted due to changes in real-time traffic conditions along the route. The worker remains on the planned route, but road conditions impact the estimated time. - **`route_change`**: The route to the destination has been recalculated. This might occur if the worker deviates from the planned route or if a more optimal route is identified. A `traffic_update` can also trigger a route recalculation. ### Priority Order If multiple reasons apply simultaneously, the webhook will report the most significant reason based on the following priority: 1. `route_change` 2. `traffic_update` 3. `position_update` ### Further Information For complete payload details, refer to the [Order ETA Change Webhook](https://developer.hypertrack.com/reference/webhooks#order-webhooks) documentation in the API Reference. ```