Toll Cost Extension API Developer's Guide

Reading a Toll Cost Extension API Response

The Toll Cost Extension API has two types of responses with the following structures.

Response for the Tollcost Resource

The resource tollcost.json provides a response that includes the following components:
  • A countries object that wraps the tollcost information for each country the route traverses.
  • A roadSectionsCosts object that covers the routes (as represented by linksIds) and conditions of the toll as well as the structures involved with collecting the tolls.
  • An adminAdmissionCosts object that captures the same information as for the road section costs, just for the entering of an administrative area (for instance, the congestion charge for entering London).
  • Objects containing information on usage fees (usageFeeRequiredLinks) and toll systems (tollSystemsNames).
  • Metainformation about the processing of the request, as captured in the errors, warnings, and onError objects.
Example response structure for the tollcost.json resource:
{
  errors: [..., ..., ...],
  warnings: [..., ..., ...],
  onError: ...,
  routeTollItems: [
    {
      linkIds: [..., ..., ...],
      tollType: ...,
      country: ...,
      conditionId: ...,
      tollSystem: [
        {
          id: ...,
          name: ...,
          languageCode: ...
        },
        ...
      ],
      tollStructures: [
        {
          linkIds: [..., ...],
          name: ...,
          languageCode: ...,
          latitude: ...,
          longitude: ...,
          conditionId: ...
        },
        ...
      ],
      tollCostAlternatives: [
        {
          amount: ...,
          currency: ...,
          amountInTargetCurrency: ...,
          methodOfPayment: ...,
          daylightHours: ...,
          discountAvailable: ...,
          vehicleSpecification: {
            category: ...,
            trailerType: ...,
            minNrOfAxlesVehicle: ...,
            maxNrOfAxlesVehicle: ...,
            emissionType: ...,
            minVehicleHeight_cm: ...,
            minVehicleWeight_kg: ...,
            hazardousType: ...,
            ...
          }
        },
        ...
      ],
    },
    ...
  ]
}

Response for the Calculateroute Resource

The resource calculateroute.json provides a response that includes the following components:
  • Router response that includes all of the attributes specified in the request (response).
  • Metainformation about the processing of the request, as captured in the errors, warnings, and onError objects.
  • A costs object that includes overall costs and the detailed breakdown for driver, vehicle, and toll cost usage.
  • An optional detailedTollCosts object that provides detailed toll costs encountered along the returned route (must be requested).
All of the costs are returned in the specified currency parameter.

Example response srtructure for the calculateroute.json resource:
{
  "response": {...},
  "errors": [
    ...,
    ...,
    ...
  ],
  "warnings": [ 
    ...,
    ...,
    ...
  ],
  "onError": ...,
  "costs": {
    "totalCost": ...,
    "currency": ...,
    "details": {
      "driverCost": ...,
      "vehicleCost": ...,
      "tollCost": ...
    }
  },
  "tollCost": {
    "routeTollItems": [
      {...}
      ...
    ]
  }
}