Skip to main content

SUV Commute Truecost | Climes API


This endpoint provides the truecost of commuting in an SUV

Request Parameters

Request Schema

This is the schema for the suv commute truecost api. Each request payload requires configs

Configs Schema

NameDescriptionTypeOptional
distanceThe total distance of the journey in km.
Default will be set as 100(km)
numberoptional
vehicle_typeType of vehicle used for the journey.string
Enum : SUV
required
total_capacityTotal number of seats in the suv.
Default will be set as 8.
numberoptional
seats_occupiedTotal number of seats that will be occupied by the user.
Default will be set at 7
numberoptional

Endpoint

/v3/transportation

Method

POST

Headers

{
'x-api-key' : 'API_KEY',
'Content-Type' : 'application/json'
}

Payload

{
"configs": {
"distance": 50,
"vehicle_type": "SUV",
"total_capacity": 8,
"seats_occupied": 6
}
}

Response Parameters

Response Schema

NameDescriptionType
messageA human readable string describing response for the given request.string
truecostThis object contains the calculated truecost values for the request.object
entire_suv_truecostThis is the total truecost in Kg CO2e for the entire suv.number
individual_seat_truecostThis is the total truecost in Kg CO2e for the each occupied seat of that suv.This number is obtained by simply dividing entire_suv_truecost with seats_occupied.number
caution

The error message is for your information, not the end users.
Please use the status codes and communicate the error to user accordingly
The API returns the first validation error that is encountered even if there are multiple errors with the request

Status Code

200

Response Data

{
"message" : "Truecost calculated successfully",
"truecost" : {
"entire_suv_truecost" : 24,
"individual_seat_truecost" : 4
}
}

Sample Request

curl --location --request POST 'BASE_URL/v3/transportation'  
--header 'x-api-key: API_KEY'
--header 'Content-Type: application/json'
--data-raw '{
"configs": {
"distance": 50,
"vehicle_type": "SUV",
"total_capacity": 8,
"seats_occupied": 6
}
}'

Sample Response

Below are sample responses for the above request.

Responses

{
"message": "Truecost calculated successfully",
"truecost": {
"entire_suv_truecost": 24,
"individual_seat_truecost": 4
}
}