Skip to main content

Get Trips For Driver API

This API endpoint retrieves the list of assigned trips for a specific driver or vendor driver. It provides detailed, segregated information per trip, including pickup and delivery addresses, assigned manpower, and the driver's job acceptance status.

Endpoints​

1. Company Driver Trips​

Retrieves trips assigned to a standard company driver.

GET /getTripsForDriver/{driverId}/{authKey}

Path Parameters:

ParameterTypeDescription
driverIdStringThe unique identifier (username/email/ID) of the driver.
authKeyStringThe authentication key for the user, used for validation.

2. Vendor Driver Trips​

Retrieves trips assigned to a vendor driver.

GET /getripsForVendorDriver/{userId}/{password}

Path Parameters:

ParameterTypeDescription
userIdStringThe unique identifier of the vendor driver.
passwordStringThe authentication password/key for the vendor.

Query Parameters (Pagination)​

Both endpoints support optional query parameters for pagination, allowing for more efficient loading of large trip lists.

ParameterTypeDescription
offsetIntegerThe starting index of the trips to return (0-indexed). Example: 0.
limitIntegerThe maximum number of trips to return in this request. Example: 10.

Note: If offset and limit are omitted, the API will return all assigned trips at once.

Request​

Method: GET Content-Type: N/A

No request body is required.

Response​

Content-Type: application/json

The response is a JSON object containing the totalCount of available trips and a trips array, where each object represents a fully segregated trip with its specific details.

Response Schema​

{
"totalCount": 42,
"trips": [
{
"tripId": "TRP-20231024-001",
"driverAcceptedJob": true,
"driverAcceptedTime": "2023-10-24 08:30:00.0",
"status": "1",
"result": [
{
"id": 105,
"state": 12,
"stateName": "Selangor",
"city": "Klang",
"address": "123 Port Road",
"delivered": false,
"goodDescription": [
{
"shipRefNo": "DO-9921",
"pieces": 50,
"weight": 500.0
}
]
}
],
"manpower": [
{
"id": 12,
"name": "John Helper",
"role": "Loader"
}
]
}
]
}

Key Response Fields​

FieldTypeDescription
totalCountIntegerThe total number of open/assigned trips available for the driver, regardless of current pagination limits. Useful for determining if there are more pages to load.
tripsArrayAn array containing individual trip objects.

Trip Object​

FieldTypeDescription
tripIdStringThe unique identifier for the trip planner.
driverAcceptedJobBooleanIndicates whether the driver has acknowledged/accepted this specific trip.
driverAcceptedTimeString|nullThe timestamp when the driver accepted the trip. Null if not yet accepted.
statusStringStatus flag for the trip object (always returns "1" for success).
resultArrayA list of address objects (Pickups, Deliveries, etc.) associated only with this specific trip. Includes cached stateName strings and goods descriptions.
manpowerArrayA list of manpower/helpers assigned only to this specific trip.

Notes​

  • Optimized Batch Fetching: The API internally uses getBatchBookingDetailsListForTrips to fetch all trip details within a single database transaction, completely preventing N+1 query bottlenecks.
  • State Caching: Location Lookups (converting a State ID to its String name) are cached dynamically during processing to prevent redundant database queries.
  • Segregated Data: Unlike legacy endpoints, the result (addresses) and manpower arrays are strictly grouped inside their respective tripId object, rather than being flattened at the root level.
  • Filtering: These endpoints exclusively return actively assigned trips. Bookings with statuses CANCELLED or JOB_CLOSED are safely filtered out.