Starting a Trip
Learn how to start a trip remotely on behalf of a user.
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:
- Have a valid JWT: see Generating and Signing a Valid JWT Guide.
- Have a User ID: see Creating a User Guide.
- The User resource should have accepted the required legal agreements (See Accepting Legal Agreements Guide).
- The User resource should comply with the required regional document verifications (See Checking and Completing Document Verification Guide).
- Have a vehicle ID: see How to Get a Vehicle
Code Sample
Test it:
- Staging
- Production
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'
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.ridedott.com/v1alpha2/trips:start'
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:
- Staging
- Production
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'
curl --location --request GET \
--header 'Content-Type: application/json' \
--header 'User-Agent: {COMPANY_NAME}' \
--header 'Authorization: Bearer {JWT}' \
'https://web.maas.api.ridedott.com/v1alpha2/trips?user_id={userId}&state=TRIP_STATE_ACTIVE'