Closed Andy3189 closed 8 months ago
This endpoint calculates the CO2 emissions for a route.
POST
The request must be in JSON format and contain a route consisting of steps with a vehicle, a start and endpoint and/or a distance in meters.
Content-Type: application/json
{ "steps": [ { "start": "Alexanderplatz", "end": "Gesundbrunnnen", "vehicle": "U8", "distance": 1500 }, { "start": "Gesundbrunnnen", "end": "Westhafen", "vehicle": "S41", "distance": 400 } ] }
The response is a JSON object containing the co2 (in g) parameter for this route. The successfull response code is 200.
200
{ "co2": 200, }
In case there is invalid route data, the return code is 400 and a JSON containing the reason
{ "error": "Invalid route" }
Co2 Calculator Rest Endpoint Documentation
/v1/calc/co2
This endpoint calculates the CO2 emissions for a route.
HTTP Method
POST
Request
The request must be in JSON format and contain a route consisting of steps with a vehicle, a start and endpoint and/or a distance in meters.
Headers
Content-Type: application/json
Body
Response
Success
The response is a JSON object containing the co2 (in g) parameter for this route. The successfull response code is
200
.Error
In case there is invalid route data, the return code is 400 and a JSON containing the reason