Trip
Handles Trip related requests with IMS web services.
Fetch by ID
Parameters:
id
: The unique ID of the `Trip`expansions
: A `Set` ofExpansions
for the `Trip`. Defaults to an empty set.
The Expansion includes events
, scores
, geometry
, and user
.
Concrete example
To fetch a trip by ID one can use following snippet
Fetch by user
Fetch a Trip
collection with expanded detail.
Parameters:
user
: The user for which trips are being fetched. Ifnil
, fetches the trips for the currently authenticatedUser
. Defaults tonil
.filters
: A Set ofFilters
for the request. Defaults to an empty set..expansions
: ASet
ofExpansion
s for the collection.
Concrete example
To fetch a trip by user one can use following snippet
Fetch all
Parameters:
filters
: A Set ofFilters
for the request. Defaults to an empty set..expansions
: ASet
ofExpansion
s for the collection.
The filters include cursor(limit, offset)
, date(start, end)
, check here for paging through trips from the logbook.
Concrete example
To fetch all trips one can use following snippet
Update trip
Parameters:
trip
: TheTrip
to update.transportMode
: TheTransportMode
to apply to theTrip
.purpose
: ThePurpose
to apply to theTrip
.
Concrete example
To update the trip one can use following snippet
Fetch trips by vehicle
- Parameters:
vehicleId
: Theid
of the vehicle for which we want the list ofTrip
vehicleTripsLimit
: The maximum number of tripsshouldExpandScores
: Iftrue
will provide the scores information inside theTrip
object
Concrete example
To fetch trips by vehicle, one can use following snippet
Filter
The Trip APIs support pagination through a cursor parameter, which allows efficient navigation through a user's trips. The cursor utilizes two key fields: limit and offset.
Cursor Parameters
limit: Specifies the maximum number of trips to retrieve per request. If not provided, the default value is
50
.offset: Defines the starting point (index) for fetching trips, relative to the most recent trip.
Usage Example
Assume a user has a total of 200 trips. The host application can retrieve trips in pages using the cursor parameters as follows:
Fetch the Most Recent Trips To retrieve the 50 most recent trips:
Fetch the Next Page of Trips To retrieve the next 50 trips:
Continue Paging Through Trips Subsequent requests can increment the
offset
by thelimit
value to fetch further pages:
Key Points to Note
The
limit
value should be chosen based on the application's requirement for batch size, balancing data size and API call frequency.Pagination parameters enable efficient navigation through the logbook without overwhelming the API or client application with large data responses.
Last updated