Toll

Example – Route with sections using vehicle with raised axles

The following example considers a route in Brazil between the cities of Guaxupé – MG to São Carlos – SP, with two intermediate stops in the cities of Casa Branca – SP and Porto Ferreira – SP.

The vehicle used in the example will be a truck with five double axles. However, on the stretch between Casa Branca and Porto Ferreira, one of the truck’s axles will be lifted. Therefore, the amount charged for tolls on this stretch should be the amount of four double axles.

Next, we will see how to replicate this scenario in requests to the Toll API and Trip API.

Request

Request with Independent endpoint

The route in the example has 4 stopping points. Therefore, the legs array must contain 3 objects, the first one referring to the stretch from Guaxupé – MG to Casa Branca – SP, the second one referring to the stretch from Casa Branca – SP to Porto Ferreira – SP, and the last one referring to the stretch from Porto Ferreira – SP to São Carlos – SP.

Within each object in legs array, it is possible to define a different vehicleType. Therefore, in the stretch with a raised axle we will use TRUCK_WITH_FOUR_DOUBLE_AXLES and in the others we will use TRUCK_WITH_FIVE_DOUBLE_AXLES.

The complete request can be seen below:

{
    "legs": [
        {
            "vehicleType":"TRUCK_WITH_FIVE_DOUBLE_AXLES",
            "points": "l}_aC`yb|GLELGDIBUKgAEW_AFMXc@|AbAd@[r@iAvCs@~Ai@nAQZ@VFJJLTNdFlQTr@Nn@J|@D^@h@@dBBh@B`@F\\QLHJ`ChH]^eA~@iFpE_B|AgB~AoD|C_A|@gClJe@vBId@Oz@Kt@Ed@?\\@HDLhBp@Pf@pEzKf@lA|@`Ch@nAL`D`@zFwSbBwHp@iDVe@@Y?SCOEQIa@WeBcD_@WGCI@E?IHCBAJ?FFZTd@|AlCrCfFbBvBvBpCxHdNn@nAt@dBf@vAZfAd@pBVtAVjBRjBLlBDpA@xAAvAMfC}F~u@e@tFSnBYdCwBfQCbA?hABlBLfB\\fCVrA^rAf@tAvNbZxB~EZ|@`@|Ad@|BLfAHbAF`ABfAAtBCx@Q`CKx@Kp@wAvFsFjSqDhNcCfJKNQf@m@vA[f@Wr@kAxEaAhGiFvRiFrRi@xBq@`Cq@hCY~@oBbHyAtFY`BOrAOdBGbBAv@@`A@p@Dt@N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nJw\\t}AcOtr@eDjOeFpVeEvR}|@jdE}B`LsBfJgCtLk@|BcAnDeBvEgBdEeApBcAdBsClEcVz^k^lj@wj@r{@wJjOoCbEwEhHwuAfwBg_AjxAoPtVqCpEmC|DeBlCsA`BMDQAEAGEKQAK@IBIFKpDsEhA~@bAt@qCvFKJKDG@OEKIIMAW@IHWh@wAfJmN"
        }
    ],
    "source": "MAPLINK"
}

Request with Trip API

In Trip API, in the toll object you will need to add the following parameters:

  • vehicleType – Type of vehicle to be considered on the route;
  • variableAxles – Array of objects, where each object must contain the following parameters:
    • fromSiteId – ID of the point where the new vehicle type should start to be considered;
    • toSiteId – ID of the end point of the section where the new vehicle type should be considered;
    • newVehicleType – Vehicle type applied only to this section.

Para esse exemplo, em vehicleType definimos TRUCK_WITH_FIVE_DOUBLE_AXLES. E em newVehicleType definimos TRUCK_WITH_FOUR_DOUBLE_AXLES para o trecho entre os pontos Casa Branca-SP e Porto Ferreira-SP

For this example, in vehicleType we define TRUCK_WITH_FIVE_DOUBLE_AXLES. And in newVehicleType we define TRUCK_WITH_FOUR_DOUBLE_AXLES for the section between Casa Branca-SP and Porto Ferreira-SP.

The full request can be found below:

{
    "calculationMode": "THE_FASTEST",
    "points": [
        {
            "siteId": "Guaxupe-MG",
            "latitude": -21.3040646,
            "longitude": -46.713925
        },
        {
            "siteId": "Casa Branca-SP",
            "latitude": -21.771147,
            "longitude": -47.087627
        },
        {
            "siteId": "Porto Ferreira-SP",
            "latitude": -21.853608019457205,
            "longitude": -47.489747900635386
        },
        {
            "siteId": "São Carlos-SP",
            "latitude":-21.914103888100573, 
            "longitude": -48.0435241019627
        }
    ],
    "toll": {
        "vehicleType": "TRUCK_WITH_FIVE_DOUBLE_AXLES",
        "variableAxles": [
            {
                "fromSiteId": "Casa Branca-SP",
                "toSiteId": "Porto Ferreira-SP",
                "newVehicleType": "TRUCK_WITH_FOUR_DOUBLE_AXLES"
            }
        ]
    }
}

Response

In both cases in this example, the second object in the legs array, which corresponds to the route between the cities of Casa Branca and Porto Ferreira, will contain the values ​​for a four-axle vehicle. While the others will return the values ​​for a five-axle vehicle.

Response with Independent endpoint

{
    "legs": [
        {
            "tolls": [
                {
                    "id": "1032",
                    "name": "Pórtico - Sarmiento",
                    "address": "Avenida Sarmiento, 4254",
                    "city": " ",
                    "state": {
                        "name": "Ciudad Autonoma de Buenos Aires",
                        "code": "Ciudad Autonoma de Buenos Aires"
                    },
                    "country": "Argentina",
                    "concession": "Ausa",
                    "direction": "WEST",
                    "coordinates": {
                        "latitude": -34.5671991,
                        "longitude": -58.4063059
                    },
                    "serviceTypes": [],
                    "price": 2348.84
                }
            ],
            "legTotalCost": 2348.84,
            "vehicleType": "TRUCK_WITH_TWO_DOUBLE_AXLES",
            "condition": {
                "billingType": "NORMAL",
                "period": "NORMAL"
            },
            "calculationDate": 1738861232000
        }
    ],
    "totalCost": 2348.84
}

Response with Trip API

{
    "legs": [
        {
            "tolls": [
                {
                    "id": "1032",
                    "name": "Pórtico - Sarmiento",
                    "address": "Avenida Sarmiento, 4254",
                    "city": " ",
                    "state": {
                        "name": "Ciudad Autonoma de Buenos Aires",
                        "code": "Ciudad Autonoma de Buenos Aires"
                    },
                    "country": "Argentina",
                    "concession": "Ausa",
                    "direction": "WEST",
                    "coordinates": {
                        "latitude": -34.5671991,
                        "longitude": -58.4063059
                    },
                    "serviceTypes": [],
                    "price": 2348.84
                }
            ],
            "legTotalCost": 2348.84,
            "vehicleType": "TRUCK_WITH_TWO_DOUBLE_AXLES",
            "condition": {
                "billingType": "NORMAL",
                "period": "NORMAL"
            },
            "calculationDate": 1738861232000
        }
    ],
    "totalCost": 2348.84
}