Skip to main content

Starting a Trip

Learn how to start a trip remotely on behalf of a user.

caution

Calling this endpoint will unlock the vehicle and start a ride.

Requirements

Before being able to start a trip you need to comply with the following items:

  1. Have a valid JWT: see Generating and Signing a Valid JWT Guide.
  2. Have a User ID: see Creating a User Guide.
  3. Have a vehicle ID: see How to Get a Vehicle

Code Sample

Test it:

curl --location --request POST \
--header 'Content-Type: application/json' \
--header 'User-Agent: {COMPANY_NAME}' \
--header 'Authorization: Bearer {JWT}'
-d '{"userId": {userId}, "vehicleId": {vehicleId}}' \
'https://web.maas.api.staging.ridedott.com/v1alpha2/trips:start'
note

Don't forget to enter valid values for userId, vehicleId and JWT

Additional Information

Once the request is successful, a new Trip resource will be generated and returned as the response of that request. The following are some possible actions to be taken with it:

The StartTrip is idempotent, it means that it can be safely called with an identical request body until the Trip is returned (this is the recommended approach).

On rare occasions if you do know that the trip has been started but you were unable to retrieve the Trip resource you can make a call to the ListTrips API endpoint. Since a user can have only one active trip at a time it's possible to obtain its details by passing both userId and state="TRIP_STATE_ACTIVE" query parameters:

curl --location --request GET \
--header 'Content-Type: application/json' \
--header 'User-Agent: {COMPANY_NAME}' \
--header 'Authorization: Bearer {JWT}' \
'https://web.maas.api.staging.ridedott.com/v1alpha2/trips?user_id={userId}&state=TRIP_STATE_ACTIVE'