Commands

You can interact with a vehicle to produce an effect on it through an API call.

Each vehicle supports different commands.


🚧

Warning

Interactions with a vehicle may take some time.
For this reason, we have a timeout of 45 seconds on the requests handled by our system.
We suggest you set a timeout equal to or greater than 50 seconds.


Generic commands

2hire defines three generic commands on every compatible vehicle.

We choose these three commands to compose our generic set because we consider them essential to interact with a vehicle.

We abstract the idea of command taken from various use cases to obtain a single behaviour on all the compatible vehicles, regardless of the specific implementation on the vehicle.


POST
/api/v1/vehicle/:uuid/command/generic/:command
Requires authorization

Request

The url parameters should consist of the following:

ParameterTypeDescription
uuidstringThe UUID of the vehicle where the command should be executed.
commandstringIdentifier of the command to be executed.

Successful Response

The successful response will consist of the following:

ParameterTypeDescription
successbooleanThe result of the execution of the command. Returns true if the command was correctly executed by the vehicle, false otherwise.
{
  "success": true
}

Error Response

The error responses are detailed in the Errors guide.


Start

Regardless of the use case, you'll be able to access a vehicle to drive it.

e.g.

​- Peer-to-Peer Car sharing: disable immobilizer + door unlock

​- Moped sharing: open topcase + engine on

​- Scooter sharing: disable lock + engine on

POST
/api/v1/vehicle/:uuid/command/generic/start


Stop

Regardless of the use case, you'll be able to release a vehicle to finish driving it.

e.g.

​- Peer-to-Peer Car sharing: door lock + enable immobilizer

​- Moped sharing: engine off + close topcase

​- Scooter sharing: engine off + disable lock

POST
/api/v1/vehicle/:uuid/command/generic/stop


Locate

Regardless of the use case, you'll be able to identify a vehicle among others.

e.g.

​- Car: turn on the headlights

​- Scooter: beep

POST
/api/v1/vehicle/:uuid/command/generic/locate


Specific commands

A set of specific commands based on a vehicle's configuration.

You'll need 2hire support to use them.

e.g. Car: open trunk

📘

Didn't find what you were looking for?

Are you looking for a specific interaction for your unique use case?
Contact us at [email protected]!


POST
/api/v1/vehicle/:uuid/command/specific/:command
Requires authorization

Request

The url parameters should consist of the following:

ParameterTypeDescription
uuidstringThe UUID of the vehicle where the command should be executed.
commandstringIdentifier of the command to be executed.

Successful Response

The successful response will consist of the following:

ParameterTypeDescription
successbooleanThe result of the execution of the command. Returns true if the command was correctly executed by the vehicle, false otherwise.
{
  "success": true
}

Error Response

The error responses are detailed in the Errors guide.


📘

Info

If you want to test the contents of this guide, please refer to our testing environment.