{"id":3291,"date":"2023-12-18T17:49:00","date_gmt":"2023-12-18T17:49:00","guid":{"rendered":"https:\/\/developers.maplink.global\/?p=3291"},"modified":"2025-02-11T18:38:43","modified_gmt":"2025-02-11T18:38:43","slug":"example-route-with-sections-using-vehicle-with-raised-axles","status":"publish","type":"post","link":"https:\/\/developers.maplink.global\/en\/example-route-with-sections-using-vehicle-with-raised-axles\/","title":{"rendered":"Example \u2013 Route with sections using vehicle with raised axles"},"content":{"rendered":"\n<p>The following example considers a route in Brazil between the cities of Guaxup\u00e9 &#8211; MG to S\u00e3o Carlos &#8211; SP, with two intermediate stops in the cities of Casa Branca &#8211; SP and Porto Ferreira &#8211; SP. <\/p>\n\n\n\n<p>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&#8217;s axles will be lifted. Therefore, the amount charged for tolls on this stretch should be the amount of four double axles. <\/p>\n\n\n\n<p>Next, we will see how to replicate this scenario in requests to the Toll API and Trip API.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Request<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Request with Independent endpoint<\/h3>\n\n\n\n<p>The route in the example has 4 stopping points. Therefore, the <code>legs<\/code> array must contain 3 objects, the first one referring to the stretch from Guaxup\u00e9 \u2013 MG to Casa Branca \u2013 SP, the second one referring to the stretch from Casa Branca \u2013 SP to Porto Ferreira \u2013 SP, and the last one referring to the stretch from Porto Ferreira \u2013 SP to S\u00e3o Carlos \u2013 SP.<\/p>\n\n\n\n<p>Within each object in <code>legs<\/code> array, it is possible to define a different <code>vehicleType<\/code>. Therefore, in the stretch with a raised axle we will use <code>TRUCK_WITH_FOUR_DOUBLE_AXLES<\/code> and in the others we will use <code>TRUCK_WITH_FIVE_DOUBLE_AXLES<\/code>.<\/p>\n\n\n\n<p>The complete request can be seen below:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"json\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-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OrG~UtFfSnD|LfPvk@~AfGZtA`AjElAfGx@pE^zCfAhIdChVJpALjBjA|L`AdJj@dI|AxM\\\\jDTrBf@nDn@vD`@lBzCvJb@hA`BxDpI|SpGzNtKtWvG~OxMz[zFbNb@fAvJ~UZt@jL`YzK|WjApCjGhOV|@Jv@Hb@^bAHN~@jARZ^v@|Szg@dCxFnCvGpDbJjDdI|GvPlAtCvB|Gr@xA|ClHfBpEhBlE\\\\t@pBnFfDbIj@jAb@fAjBrF^vA\\\\`B|@zDXzATdB^rDRhCNnAHzAFxBD~CQbIQfDU|CUpBk@`Eg@nCa@nBg@tBUx@a@tAqAhD}CpHMf@yAhC}@pAeAbB{IfLe\\\\dc@iEzFmBtCoAhCg@lAk@dBi@zB_@fC_@jFCzA?rBl@hOHtDHxDBhBCxGCzCq@jb@BpDNlDHjAVvB^`CVjAZfBETCBGHM@[CsCA@pC?|NBjEB`@XlBN|@ATCPEJMPOPORKFYFQFWPIPY`@WRWLUDW@_@@uKUgBS{IoAkFq@iRmBwUeCka@iEoEi@}BIqCEeA@cBDeBLwAT{B^sBh@aARk@XeCfAqBbAcBfA}AjA}@t@aCpCcArAu@z@eSpXyAlBuApBuD`FsDxE}@jAsQrVgL~O_FlGgNdR}@`Bs@tAu@bBi@vAe@xAaAlD]xAaC`MeDlO_E`Q_@nBaBzHAB{@`E}@hEo@fCsBvJsDtPyBnJw\\\\t}AcOtr@eDjOeFpVeEvR}|@jdE}B`LsBfJgCtLk@|BcAnDeBvEgBdEeApBcAdBsClEcVz^k^lj@wj@r{@wJjOoCbEwEhHwuAfwBg_AjxAoPtVqCpEmC|DeBlCsA`BMDQAEAGEKQAK@IBIFKpDsEhA~@bAt@qCvFKJKDG@OEKIIMAW@IHWh@wAfJmN\"\n        }\n    ],\n    \"source\": \"MAPLINK\"\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Request with Trip API<\/h3>\n\n\n\n<p>In Trip API, in the <code>toll<\/code> object you will need to add the following parameters:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>vehicleType<\/code>&nbsp;\u2013 Type of vehicle to be considered on the route;<\/li>\n\n\n\n<li><code>variableAxles<\/code>&nbsp;\u2013 Array of objects, where each object must contain the following parameters:\n<ul class=\"wp-block-list\">\n<li><code>fromSiteId<\/code> \u2013 ID of the point where the new vehicle type should start to be considered;<\/li>\n\n\n\n<li><code>toSiteId<\/code> \u2013 ID of the end point of the section where the new vehicle type should be considered;<\/li>\n\n\n\n<li><code>newVehicleType<\/code> \u2013 Vehicle type applied only to this section.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>Para esse exemplo, em&nbsp;<code>vehicleType<\/code>&nbsp;definimos&nbsp;<code>TRUCK_WITH_FIVE_DOUBLE_AXLES<\/code>. E em&nbsp;<code>newVehicleType<\/code>&nbsp;definimos&nbsp;<code>TRUCK_WITH_FOUR_DOUBLE_AXLES<\/code>&nbsp;para o trecho entre os pontos&nbsp;<code>Casa Branca-SP<\/code>&nbsp;e&nbsp;<code>Porto Ferreira-SP<\/code><\/p>\n\n\n\n<p>For this example, in <code>vehicleType<\/code> we define <code>TRUCK_WITH_FIVE_DOUBLE_AXLES<\/code>. And in <code>newVehicleType<\/code> we define <code>TRUCK_WITH_FOUR_DOUBLE_AXLES<\/code> for the section between<code> Casa Branca-SP<\/code> and <code>Porto Ferreira-SP<\/code>.<\/p>\n\n\n\n<p>The full request can be found below:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"json\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">{\n    \"calculationMode\": \"THE_FASTEST\",\n    \"points\": [\n        {\n            \"siteId\": \"Guaxupe-MG\",\n            \"latitude\": -21.3040646,\n            \"longitude\": -46.713925\n        },\n        {\n            \"siteId\": \"Casa Branca-SP\",\n            \"latitude\": -21.771147,\n            \"longitude\": -47.087627\n        },\n        {\n            \"siteId\": \"Porto Ferreira-SP\",\n            \"latitude\": -21.853608019457205,\n            \"longitude\": -47.489747900635386\n        },\n        {\n            \"siteId\": \"S\u00e3o Carlos-SP\",\n            \"latitude\":-21.914103888100573, \n            \"longitude\": -48.0435241019627\n        }\n    ],\n    \"toll\": {\n        \"vehicleType\": \"TRUCK_WITH_FIVE_DOUBLE_AXLES\",\n        \"variableAxles\": [\n            {\n                \"fromSiteId\": \"Casa Branca-SP\",\n                \"toSiteId\": \"Porto Ferreira-SP\",\n                \"newVehicleType\": \"TRUCK_WITH_FOUR_DOUBLE_AXLES\"\n            }\n        ]\n    }\n}<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Response<\/h2>\n\n\n\n<p>In both cases in this example, the second object in the <code>legs<\/code> array, which corresponds to the route between the cities of Casa Branca and Porto Ferreira, will contain the values \u200b\u200bfor a four-axle vehicle. While the others will return the values \u200b\u200bfor a five-axle vehicle.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Response with Independent endpoint<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"json\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">{\n    \"legs\": [\n        {\n            \"tolls\": [\n                {\n                    \"id\": \"1032\",\n                    \"name\": \"P\u00f3rtico - Sarmiento\",\n                    \"address\": \"Avenida Sarmiento, 4254\",\n                    \"city\": \" \",\n                    \"state\": {\n                        \"name\": \"Ciudad Autonoma de Buenos Aires\",\n                        \"code\": \"Ciudad Autonoma de Buenos Aires\"\n                    },\n                    \"country\": \"Argentina\",\n                    \"concession\": \"Ausa\",\n                    \"direction\": \"WEST\",\n                    \"coordinates\": {\n                        \"latitude\": -34.5671991,\n                        \"longitude\": -58.4063059\n                    },\n                    \"serviceTypes\": [],\n                    \"price\": 2348.84\n                }\n            ],\n            \"legTotalCost\": 2348.84,\n            \"vehicleType\": \"TRUCK_WITH_TWO_DOUBLE_AXLES\",\n            \"condition\": {\n                \"billingType\": \"NORMAL\",\n                \"period\": \"NORMAL\"\n            },\n            \"calculationDate\": 1738861232000\n        }\n    ],\n    \"totalCost\": 2348.84\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Response with Trip API<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"json\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">{\n    \"legs\": [\n        {\n            \"tolls\": [\n                {\n                    \"id\": \"1032\",\n                    \"name\": \"P\u00f3rtico - Sarmiento\",\n                    \"address\": \"Avenida Sarmiento, 4254\",\n                    \"city\": \" \",\n                    \"state\": {\n                        \"name\": \"Ciudad Autonoma de Buenos Aires\",\n                        \"code\": \"Ciudad Autonoma de Buenos Aires\"\n                    },\n                    \"country\": \"Argentina\",\n                    \"concession\": \"Ausa\",\n                    \"direction\": \"WEST\",\n                    \"coordinates\": {\n                        \"latitude\": -34.5671991,\n                        \"longitude\": -58.4063059\n                    },\n                    \"serviceTypes\": [],\n                    \"price\": 2348.84\n                }\n            ],\n            \"legTotalCost\": 2348.84,\n            \"vehicleType\": \"TRUCK_WITH_TWO_DOUBLE_AXLES\",\n            \"condition\": {\n                \"billingType\": \"NORMAL\",\n                \"period\": \"NORMAL\"\n            },\n            \"calculationDate\": 1738861232000\n        }\n    ],\n    \"totalCost\": 2348.84\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The following example considers a route in Brazil between the cities of Guaxup\u00e9 &#8211; MG to S\u00e3o Carlos &#8211; SP, with two intermediate stops in the cities of Casa Branca &#8211; SP and Porto Ferreira &#8211; SP. The vehicle used in the example will be a truck with five double axles. However, on the stretch [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[163],"tags":[],"class_list":["post-3291","post","type-post","status-publish","format-standard","hentry","category-toll-en"],"acf":[],"_links":{"self":[{"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/posts\/3291","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/comments?post=3291"}],"version-history":[{"count":5,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/posts\/3291\/revisions"}],"predecessor-version":[{"id":3296,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/posts\/3291\/revisions\/3296"}],"wp:attachment":[{"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/media?parent=3291"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/categories?post=3291"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/tags?post=3291"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}