26 Jul 2023 | 4 min read
For a Car Rental or Peer-to-Peer Car-Sharing company, having complete control over the fleet is key for a successful management of the business.
To be able to control the fleet and the status of cars, Car Rentals or Peer-to-Peer businesses need to embrace a tech-based approach and adopt a digital strategy around car connectivity.
Each car has its own language, standardizing all languages used by connected cars is crucial for the implementation of a digital strategy and for allowing access to extremely important functions such as vehicles’ interactions.
Having a connected car makes remote interactions such as lock and unlock of doors possible, making the rental process for both a Car Rental company and a Peer-to-Peer car sharing way smoother, immediate and technologically advanced. Giving customers faster and contactless vehicle access!
And how does this work?
In this article we will break down how the integration of commands takes place on a technical level thanks to 2hire technology.
👀 Stay tuned for the next episode about signals 👀
As you may already know, the 2hire service that enables vehicle connectivity is called Adapter. The first step in integrating Adapter’s API with your own service and ecosystem is to determine the compatibility of the vehicles in your fleet with our solution.
There are two possibilities for integrating your vehicles through our product: your vehicle can either be natively connected, as most recent models come with embedded connectivity by the manufacturer, or it can be a non-connected vehicle eligible for installation of our 2hire box.
To obtain more information about the manufacturers or models supported and to inquire about the compatibility of your vehicles, please contact our business unit.
Once you have confirmed the compatibility of your vehicles, the next step is to integrate the Adapter API. The real power of Adapter lies in its ability to expose a unified and homogeneous interface for interacting with a diverse range of vehicles from different manufacturers and models. From a Mercedes Vito to a Fiat 500 the difference is not so steep, with Adapter you manage both in the same way.
To facilitate the development of your integration, you can utilize our Developer Portal and simulate real vehicles in our test environment. The API Reference tab contains four sections:
Prod API: This collection directly connects to our production service, allowing you to interact with your real vehicles if you already have your production credentials.
Integration Test: This set of APIs is designed to mock responses from our server. The responses are static and dependent on the input parameters, making it useful for studying our service or for early-stage development.
Test API: These endpoints enable you to develop and test your application. The service points to a special Test environment that replicates the behavior of our Production servers. You can set up mock vehicles to simulate different scenarios.
E2E Test: These endpoints allow you to create and control mock vehicles for use with the Test API.
Once you have completed the implementation and thoroughly tested it using the Test API, you are ready to switch to the Production routes.
For the scope of this post, we will focus on the development phase using our Test API and E2E tests. This integration process involves:
Want to have a chat about it? Contact us and let’s book a product demo!
Let’s delve into each aspect:
The first step is to sign up on our Developer Portal. This will provide you with a client ID and secret to obtain tokens for authenticating your calls to our service.
Please note that those credentials are for the Test environment only, so they will only work with the Integration Test, Test API and E2E Test endpoints.
To initiate the integration process, you need to create a mock vehicle for testing and development purposes. You can easily accomplish this using our convenient E2E test section.
The vehicle creation endpoint will return a set of ids: the identifier can be used with the E2E test endpoints to control the newly created mock vehicle, the other id (the name may vary for each connectivity provider, e.g.: qrCode for 2hireBoard) will be used to register the vehicle with the Test API.
After creating the mock vehicle, you must register it through the Test API using the registration endpoint. This step enables the Adapter Test environment to recognize and establish a connection with your vehicle.
For this example, we will use a 2hireBox mock vehicle. To create it, simply use the create vehicle endpoint, leaving the default body parameters. You can conveniently call the endpoint within our Developer Portal.
As already mentioned, the response will provide the list of device IDs to be used in the registration endpoint. Specifically, for the 2hireBox mock, you need to retrieve the QR code.
Additionally, to register a 2hireBox, you must specify a profile ID.
Please note that different connectivity providers may have additional required properties aside from the vehicle identifier, so make sure to check any specific integration requirements.
To quickly obtain a profile ID suitable for testing purposes, you can use the public profile list endpoint.
Once you have both the QR code and profile ID, you can proceed with registering the mock vehicle in the test environment.
Next, we will integrate the generic commands exposed by Adapter, namely the Start, Stop, and Locate commands. We will focus on the start and stop commands as they are the fundamental commands for controlling the vehicle and are intuitively used to initiate or conclude a trip.
Depending on the vehicle model, the start command will execute the necessary procedures to enable the user to access the vehicle and start driving. Adapter takes care of all the required work to prepare the vehicle for the trip, so it is transparent to you. The same applies to the stop command, which handles all the necessary actions to conclude the trip and shut down the vehicle.
It is important to implement proper error handling on your side. Commands may fail for various reasons, and your application should react based on your own business logic. In our Developer Portal, you will find a comprehensive list of status codes and error messages that may arise from each command. We provide standardized error codes, but there will always be a cause field specified in the response.
We encourage you to extensively test different scenarios by changing the vehicle status through the E2E test suite to observe the generated responses.
After successfully completing the integration and testing phase, you are ready to transition to the production environment. This involves checking eligibility for production, registering your vehicles in the live system, and utilizing the full suite of 2hire Adapter functionalities. You can test each endpoint beforehand using our Developer Portal.
The authentication process in production is the same as in the Test suite. However, you will need to obtain your production credentials from your business referent.
Once your vehicles are deemed eligible, you can proceed with the registration process in the live system. Make sure to gather all the necessary information for registering your vehicles based on the selected connectivity provider, ensuring a smooth registration without any delays. You can find all the details in the Developer Portal.
Once registered, you can start interacting with your real vehicles through Adapter’s functionalities, including data exposure and command forwarding, which were developed using the Test suite.
Congratulations! You have successfully integrated the Adapter generic commands into your car rental or peer-to-peer car sharing platform. Now you can implement your own business logic while leaving the “hard work” of interacting with your vehicles to Adapter. With just one integration, you can connect, manage, and control various vehicles from different manufacturers, as long as they are compatible with our service. How cool is that?
Stay tuned for the next installment in this series, where we will delve deeper into the advanced features and customization options offered by 2hire Adapter.
Senior Engineer at 2hire
Computer engineer with a passion for art. When not coding, you may find me painting, reading, binge-watching tv shows, or, most probably, sleeping.