Toll Cost Extension API Developer's Guide

Cost-Optimized Route

User Story

The user, a logistic company, wants to retrieve the cheapest route between Paris and Le Havre in France, for a truck that has a total weight of 40 tons.

Request

The parameter tollVehicleType and limitedWeight define the type of vehicle, as do the remaining vehicle specification parameters. The parameters waypoint0 and waypoint1 define the route.

https://tce.cit.api.here.com/2/calculateroute.json
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
&driver_cost=15
&vehicle_cost=0.7
&currency=EUR
&tollVehicleType=3
&trailerType=2
&trailersCount=1
&vehicleNumberAxles=3
&trailerNumberAxles=2
&emissionType=5
&height=4.0m
&trailerHeight=4.0m
&vehicleWeight=12.0t
&limitedWeight=40.0t
&passengersCount=1
&tiresCount=10
&commercial=1
&waypoint0=48.85450344626631,2.3434416413849135
&waypoint1=49.49255240285734,0.13279463294355764
&metricsystem=metric
&maneuverattributes=none
&routeattributes=gr
&mode=fastest;truck
&jsonattributes=41
&combinechange=true
&linkattributes=none,rt,fl
&legattributes=none,li,sm
&cost_optimize=1
&detail=1

Response

The response to the request contains the following information blocks:
  • the cheapest route calculated based on the parameter values specified in the GET request
  • the toll cost details of the calculated route
  • metadata about the information used in determining the route
{
  response: {
    metaInfo: {
      timestamp: "2015-09-18T07:57:13Z",
      mapVersion: "8.30.59.159",
      moduleVersion: "7.2.60.0-1202",
      interfaceVersion: "2.6.15"
    },
    route: [
      {
        waypoint: [...],
        mode: {...},
        leg: [...],
        summary: {...}
      }
    ],
    language: "en-us"
  },
  errors: [ ],
  warnings: [ ],
  onError: false,
  cost: {
    totalCost: 210.87,
    currency: "EUR",
    details: {
      driverCost: "39.62",
      vehicleCost: "136.55",
      tollCost: "34.7"
    }
  },
  tollCost: {
    routeTollItems: [
      {
        linkIds: ...,
        tollType: ...,
        ...
      },
      ...
    ]
  }
}