Building requests for the CO2 API
Before you can start using the API, you will need to obtain the authentication token.
The following headers will be required, where the word token must be replaced by the token obtained in the authentication process:
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer token'
In body all the parameters will be sent to obtain the total carbon emission of the route.
The CO2 API can be used in three different ways:
Independent endpoint
Suitable for users who use other routing services and only want to calculate CO2 emissions.
Trip API + CO2 API
The CO2 API can be used integrated with the Trip API, both synchronously and asynchronously. The information needed to calculate CO2 emissions will be added in the request to the Trip API:
- https://api.maplink.global/trip/v2/calculations – POST
Synchronous Trip - https://api.maplink.global/trip/v1/problems – POST
Asynchronous Trip
Toll for Maps API + CO2 API
Recommended for users who use Google’s Directions API. The CO2 API can be used in conjunction with the Toll for Maps API, so that the calculation of CO2 emissions will be returned with the calculation of tolls.
- https://api.maplink.global/toll/v1/directions?vehicleType={{vehicleType}} – POST
The term {{vehicleType}} must be replaced with the desired vehicle type.