Please Note: this Api uses rate limits: max. 100 requests/second and max 7 simultaneous connections are allowed!
Exceeding the rate limit will result in a http 429 error ("too many requests")
Please note: in order to get an access token and send requests to the REST API you need to contact our team to get a test account.
Visit get Access Token and provide username and password as given to you by the EcoTransIT staff.
After successful login you will receive an access token and a refresh token. Use this access token as bearer token in your calculateTransport request (see first code snippet in Authorization section)
Please note that the access token expires after a while. You can use the refresh token to get a new access token, like in the following curl request.
curl -X POST https://customer-name.ecotransit.org/realms/ETW/protocol/openid-connect/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "client_id=webservice-rest" \
-d "client_secret=<my-client-secret>" \
-d "grant_type=refresh_token" \
-d "refresh_token=<my-refresh-token>"
⚠️ Warning: Store the refresh token at a safe place as it contains sensitive information!!
An overview of the OpenId Endpoint Overview of the authorization server can be found here
https://customer-name.ecotransit.org/
The shipmentIds of the loads/unloads of the first transportChainElement will be ommitted because the emissionPercentage for them will always be 0 by definition.
https://customer-name.ecotransit.org/etw-rest/calculateCollectionAndDelivery
curl -i -X POST \
https://customer-name.ecotransit.org/etw-rest/calculateCollectionAndDelivery \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
-H 'Content-Type: application/json' \
-d '{
"transportChainElements": [
{
"location": {
"locationType": "ZIP_CODE",
"country": "DE",
"code": 20539
},
"load": [
{
"cargo": {
"unit": "TONS",
"amount": 20
}
}
]
},
{
"location": {
"locationType": "ZIP_CODE",
"country": "DE",
"code": 30167
},
"unload": [
{
"cargo": {
"unit": "TONS",
"amount": 15
},
"freightUnitIdentifier": "terminalhannoverCustomerA",
"listEmissionsInResponse": true
},
{
"cargo": {
"unit": "TONS",
"amount": 5
},
"freightUnitIdentifier": "terminalhannoverCustomerB",
"listEmissionsInResponse": true
}
]
}
],
"settings": {
"showRoute": "true"
}
}'
Successful operation
Note that the emissions for the load/undload elements of the first transportChainElement from the request are not shown in the response because they are always 0 by definition!
List of transport chain elements (TCE) showing the emissions for each leg for the whole freight
{ "emissionsPerFreightUnit": [ { … } ], "transportOperationCategory": [ { … } ], "kmlFile": "http://example.com" }