Emissions Calculation
These apps are used to calculate emissions of a trip by plane, train, car or bus, given a cabin class, the distance, the origin IATA code and the destination IATA code.
When is Troop calling my endpoint?
Troop will query your endpoint during a meeting analysis, after fetching the transport options from one of our providers. For performance reasons, your endpoint needs to accept segments in bulk, to minimize the number of HTTP calls required.
JSON Payload
The JSON payload must accept the following fields:
Field | Description | Required | Type | Example |
---|---|---|---|---|
| The transport mode. | true | One of |
|
| The segments of the trip. | true | An array of | See below |
| The methodology used to calculate the emissions. | true | String |
|
Type of RequestedSegment
:
Field | Description | Required | Type | Example |
---|---|---|---|---|
| The origin IATA code. | true | String |
|
| The destination IATA code. | true | String |
|
| The distance of the segment. | true | Float |
|
| The cabin class. | true | One of |
|
| The flight number. | true | String |
|
Example:
JSON Response
The response payload must be similar to the following. I'ts very important that the output objects inside result.data
are ordered the same way as the input objects.
The JSON response must contain an attribute data
which consists of an array of ResponseSegment
:
Type of ResponseSegment
:
Field | Description | Required | Type | Example |
---|---|---|---|---|
| The origin IATA code. | true | String |
|
| The destination IATA code. | true | String |
|
| The distance of the segment. | true | Float |
|
| The cabin class. | true | One of |
|
| The flight number. | true | String |
|
| The tonnes of CO2 emitted. | true | Float |
|
| The equivalencies of the calculated emissions. | true (although it can be empty) | An array of | See below |
Type of EmissionsEquivalency
:
Field | Description | Required | Type | Example |
---|---|---|---|---|
| The type. | true | String |
|
| The unit. | true | String |
|
| The equivalent amount of | true | Integer |
|
| Human-readable description of the above. | true | String[] |
|
Last updated