Testing the API in Postman (with Credentials)¶
Info
In this example we will use the Carbon Footprint Indicator for Transportation API. The full documentation for this API is available here.
If you are interested in testing of the Transportation Carbon Footprint API, you may contact the product team to provide you with a key.
In our example we want to calculate a carbon footprint for shipping a load of 500kg from Location A (Berlin, Germany) to location B (New York, US). The getting started document for the Transportation Carbon Footprint API specifies that this API uses x-api-key
header for authentication.
In order to calculate the carbon footprint we will navigate to the calculate
operation in our fork and configure the http headers and the http body of the request.
We will first copy the API Key in the Authorization Tab of the request, select Api-Key
as authorization type and configure the settings as in the picture below.
The API specification expects the shipment data and the geographical coordinates of the source and the target location in the request body.
{
"Shipments": [
{
"Id": "1",
"Sender_Id": "A",
"Recipient_Id": "B",
"Date": "2023-05-16T18:21:45Z",
"Gross_Weight": 500,
"Weight_Unit_Id": "kg",
"Transport_Mode_Id": "Sea",
"Equipment_Id": "40ft"
}
],
"Locations": [
{
"Id": "A",
"Country": "DE",
"Latitude": 52.52,
"Longitude": 13.40
},
{
"Id": "B",
"Country": "US",
"Latitude": 40.73,
"Longitude": -73.93
}
]
}
After clicking on send we will get an overview of all legs of the shipment journey.
{
"Result_Legs": [
{
"Shipment_Id": "1",
"Id": "1_1",
"Sender_Id": "A",
"Recipient_Id": "PLSZZ",
"Transport_Mode_Id": "road",
"Date": "2023-05-16T18:21:45Z",
"Gross_Weight": 500,
"Intensity_Factor_WTW": 80,
"Intensity_Factor_WTT": 16,
"Intensity_Factor_TTW": 64,
"Intensity_Factor_Unit": "g CO2e/t-km",
"CO2e_kg_WTW": 6.05992,
"CO2e_kg_WTT": 1.211984,
"CO2e_kg_TTW": 4.847936,
"Error_Type": null
},
{
"Shipment_Id": "1",
"Id": "1_2",
"Sender_Id": "PLSZZ",
"Recipient_Id": "PLSZZ",
"Transport_Mode_Id": "logisticsites",
"Date": "2023-05-16T18:21:45Z",
"Gross_Weight": 500,
"Intensity_Factor_WTW": 1.7,
"Intensity_Factor_WTT": null,
"Intensity_Factor_TTW": null,
"Intensity_Factor_Unit": "kg CO2e/t",
"CO2e_kg_WTW": 0.85,
"CO2e_kg_WTT": null,
"CO2e_kg_TTW": null,
"Error_Type": null
},
{
"Shipment_Id": "1",
"Id": "1_3",
"Sender_Id": "PLSZZ",
"Recipient_Id": "USJEC",
"Transport_Mode_Id": "sea",
"Date": "2023-05-16T18:21:45Z",
"Gross_Weight": 500,
"Intensity_Factor_WTW": 87,
"Intensity_Factor_WTT": 7,
"Intensity_Factor_TTW": 81,
"Intensity_Factor_Unit": "g CO2e/TEU-km",
"CO2e_kg_WTW": 55.350609492771994,
"CO2e_kg_WTT": 4.45349731551039,
"CO2e_kg_TTW": 51.533326079477376,
"Error_Type": null
},
{
"Shipment_Id": "1",
"Id": "1_4",
"Sender_Id": "USJEC",
"Recipient_Id": "USJEC",
"Transport_Mode_Id": "logisticsites",
"Date": "2023-05-16T18:21:45Z",
"Gross_Weight": 500,
"Intensity_Factor_WTW": 1.7,
"Intensity_Factor_WTT": null,
"Intensity_Factor_TTW": null,
"Intensity_Factor_Unit": "kg CO2e/t",
"CO2e_kg_WTW": 0.85,
"CO2e_kg_WTT": null,
"CO2e_kg_TTW": null,
"Error_Type": null
},
{
"Shipment_Id": "1",
"Id": "1_5",
"Sender_Id": "USJEC",
"Recipient_Id": "B",
"Transport_Mode_Id": "road",
"Date": "2023-05-16T18:21:45Z",
"Gross_Weight": 500,
"Intensity_Factor_WTW": 97,
"Intensity_Factor_WTT": 16.5,
"Intensity_Factor_TTW": 80,
"Intensity_Factor_Unit": "g CO2e/t-km",
"CO2e_kg_WTW": 0.9043794999999999,
"CO2e_kg_WTT": 0.15383775,
"CO2e_kg_TTW": 0.7458799999999999,
"Error_Type": null
}
],
"Result_Shipments": [
{
"Id": "1",
"Sender_Id": "A",
"Recipient_Id": "B",
"Transport_Mode_Id": "Sea",
"Date": "2023-05-16T18:21:45Z",
"Gross_Weight": 500,
"Weight_Unit_Id": "kg",
"CO2e_kg_WTW_sum": 64.01490899277199,
"CO2e_kg_WTT_sum": 5.81931906551039,
"CO2e_kg_TTW_sum": 57.12714207947737,
"Error_Type": null
}
],
"Result_Locations": [
{
"Id": "A",
"Country": "DE",
"Latitude": 52.52,
"Longitude": 13.4,
"Error_Type": null
},
{
"Id": "B",
"Country": "US",
"Latitude": 40.73,
"Longitude": -73.93,
"Error_Type": null
},
{
"Id": "PLSZZ",
"Country": "PL",
"Latitude": 53.417,
"Longitude": 14.55,
"Error_Type": null
},
{
"Id": "USJEC",
"Country": "US",
"Latitude": 40.717,
"Longitude": -74.033,
"Error_Type": null
}
],
"Result_Errors": []
}
The four legs of the journey are shown on the map below, and the corresponding Carbon Footprint is included in the JSON result.