Explore Roam's Trips documentation.
Trips allow you to manage broadly defined trips. Whether it's a taxi driver, food/parcel delivery, outdoor run, or anyone who needs to move from location A to B, Roam.ai location technology helps manage the process.
Trips use a combination of REST APIs and SDK Methods for the creation and management of trips. Trips can be tracked in real-time using our SDK listener methods, webhooks, and our tracking portal track.roam.ai.
Quick Trips lets you track journeys from point A to B in real-time using the
Quick Trips are ideal for:
- Fitness Tracking while on a run/ride.
- Mileage tracking for employees, riders, etc.
- Distance tracking for automobile rentals.
- Micro mobility apps for short distance tracking.
Quick Trips Workflow
Planned trips lets you plan trips ahead of time where a user can visit a single location or stop at multiple locations as part of the journey from point A to B to C to N. Start by creating a trip using
stop_locationswhere you can specify this location using coordinates of locations.
The best use cases for planned trips are:
- Ridesharing and hailing
- Food and Grocery delivery
- Last-mile delivery
Planned Trips Workflow
Trips require you to use a combination of SDK Methods and APIs to achieve real-time tracking features.
Interaction with the Trip SDK Methods may require you to use
trip_idwhile calling the methods.
The Roam API uses API keys to authenticate requests. You can view and manage your API keys in the Roam Dashboard.
Your API keys carry many privileges, so be sure to keep them secure! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth. Authentication to the API is performed via a custom header
Api-Key. Provide your API key as the value for the header
The end-user can initiate different actions depending on the requirement. This is facilitated by the Roam SDK.
For example, when the end-user clicks on the Start Tracking icon on the frontend, the client-side requests to start tracking the user's location.
To use our Roam SDK on the server-side, the SDK object is instantiated using a private API key. The client request is made using the API which connects to the web server and retrieves the necessary data.
The following sections consist of code to instantiate the SDKs on the client side both on iOS and Android and the API requests corresponding to the actions.
As the name suggests, a Quick Trip creates and starts the trip immediately. The user need not define the locations of travel and can track their journey from point A to point B using the
endTripSDK methods on their application.
Refer to the following sections to instantiate the Start Quick Trip method on iOS and Android.
Update Trip allows you to update the name, description and the stop locations for a trip.
Consider a scenario where a trip is created with stop locations A, B, and C. If you wish to update the trip with a new stop location D, all the previously created stops need to be passed along with the co ordinates for point D.
If you wish to delete a stop location, you can do so by omitting the co ordinates for that point while updating the trip. However, you can only do so as long as the user has not reached that stop location.
Only stop locations that have not been reached yet can be deleted.
Refer to the following sections for the Update Trip API and SDK methods.
The Create Trip API, specifically used for planned trips, allows you to create new trips with start and stop locations. You can define the geometry radius for these locations which will help capture the entry and exit events.
To instantiate the Create Trip SDK, refer to the following section.
The following section consists of a sample request along with the responses for the Create Trip API.
Once the trip is created, the users can perform various actions to control it. The following sections consist of information on how to integrate the SDKs on iOS and Android devices and the APIs.
The Start Trip method allows you to start a Quick Trip or a planned trip with pre-defined stop locations.
To instantiate the Start Trip SDK method on Android and iOS, refer to the following sections.
The Start Trip API starts the trip for the specified Trip ID.
The End Trip method is used to end an ongoing trip. The ended trip could be previously started, paused, and/or resumed.
Refer to the following section for information on how to instantiate the End Trip SDK on Android and iOS.
The End Trip API is used to end the trip for the given ID.
The Pause Trip method allows the user to pause a previously created trip.
To instantiate the Pause Trip SDK on Android and iOS, refer to the following sections:
Pause Trip API pauses the trip for the given ID.
The Resume Trip method is used to resume a previously paused trip.
The following section gives information on the Resume Trip SDK method for Android and iOS.
Resume trip API resumes the trip for the given Trip ID.
The Sync Trip method syncs an offline trip (with locally stored data) to the servers.
The section below shows the code to instantiate the Sync Trip method on Android and iOS.
The Get Trips API fetches the trip details for the given Trip ID. The information will include the Trip ID, name, description, state, stop locations, entry and exit timestamps at the stop locations and so on.
As the name suggests, Get Single Trip is used to fetch details for a single Trip ID. Refer to the following sections to instantiate the Get Single Trip SDK method on iOS and Android.
Get Single Trip API fetches the trip details for the provided Trip ID.
Get Multiple Trips API will fetch multiple trip details. You can use different parameters to filter out the data to be fetched. For detailed information, refer to the section below.
A trip is active when it is started and not yet ended. The Get Active Trips method returns all the trips that have been started by the user.
Below are the Get Active Trips methods for Android and iOS.
This method helps get the Trip Summary for the specified trip ID. To instantiate the Get Trip Summary method, refer the following section.
The Get Trip Summary API gives information about the entire trip with the start locations, end location stops, events, routes taken, etc.
Refer to the following section for detailed information about the API.
The Subscribe Trip method helps get real-time location data for trips. This method provides location data for both online and offline trips.
For more information on the Subscribe Trip method, refer to the following section.
To subscribe to trip events about end users, you configure Webhooks for your applications. A Webhook registers the notification URL that Roam sends notifications to.
To use the Developer Dashboard to subscribe to event notifications, refer to the following section.
There are several backend libraries you can subscribe to to receive user trips event data. We provide three libraries for location and events subscription.
The Export trip API call consolidates the trip summary in a readable format and exports the data to your system.
The different formats supported by Roam are csv, gpx, json and geojson. Refer to the following section for the API.
The Delete Trip method deletes the trip regardless of its state.
To instantiate the Delete Trip method on Android and iOS, refer the following section.
The Delete Trip API makes a soft delete of the trip for the given trip ID.
The following are some of the commonly found codes indicating client errors.
Now that you know how to instantiate our SDK methods and how the APIs function, you can create, start and control the trips using the same. You can publish location updates and also subscribe to the trip using our Roam SDK. To receive real-time location updates, we have made a provision to subscribe to Webhooks and Backend libraries. However, you can also track the trip using our Roam Tracking Dashboard.
The Roam Tracking dashboard is a fully responsive, platform compatible, and an easy-to-use interface that helps track the end-user location during a trip.
You can either provide the UserID or the TripID to start tracking. You can also create a new user with an existing API Key.
The Tracking dashboard shows the following:
- The number of stops in the created trip.
- The total distance traveled from the start to the end location.
- The duration taken to travel the distance.
- The arrival and departure timestamps for the entry and exit events at each stop location.
- ID of the end-user who traversed the distance.
In the above example, we have created a trip with three stop locations. Once the trip is created and started, the stop locations are visible on the tracking dashboard in yellow.
Check out the video below for a short demo of the tracking dashboard.
Once the trip is ended, you can see the start point indicated in green, stop locations in yellow, and the endpoint in red.