A Freight API possui integração com a Trip API. Assim você consegue obter o valor do frete mínimo diretamente nas rotas geradas pela Trip API.
O serviço Freight API pode ser utilizado de forma integrada com a Trip API. O processo consiste em apenas adicionar os parâmetros da Freight API no body da requisição para a Trip API.
Não será necessário incluir o parâmetro distance, já que a própria Trip API fornecerá a informação da distância percorrida.
O exemplo a seguir exibe uma requisição de um rota entre São Paulo - SP e Campinas - SP, a ser percorrida por um caminhão com 4 eixos duplos, incluindo cálculo de pedágios e frete (Carga: Granel sólido / Tipo de operação: D).
Endpoint utilizado: https://api.maplink.global/trip/v1/problems (Método: POST)
A requisição completa encontra-se abaixo:
{
"calculationMode": "THE_FASTEST",
"points": [
{
"latitude": -23.566329,
"longitude": -46.653690,
"siteId": "SP"
},
{
"latitude": -22.910884,
"longitude": -47.066027,
"siteId": "CAMPINAS"
}
],
"toll": {
"vehicleType": "TRUCK_WITH_FOUR_DOUBLE_AXLES",
"billing": "FREE_FLOW"
},
"freight": {
"operationType": [
"D"
],
"goodsType": [
"GRANEL_SOLIDO"
],
"axis": [
"4"
],
"roundTrip": false,
"backEmpty": false,
"otherCosts": [
{
"name": "ICMS",
"type": "PERCENT",
"value": "5"
},
{
"name": "Lucro",
"type": "PERCENT",
"value": "20"
},
{
"name": "TaxaFixa",
"type": "FIXED",
"value": "500"
}
],
"date": "2021-10-02"
}
}
A resposta completa pode ser conferida abaixo:
{
"id": "63e2522314afae02576eff0a",
"clientId": "qBPERsYpGuBp9ksxA1EGncIYlVM8ULee",
"totalDistance": 94341,
"totalNominalDuration": 5376,
"averageSpeed": 52.24,
"tollCosts": 94.00,
"legs": [
{
"distance": 94341,
"nominalDuration": 5376,
"averageSpeed": 52.24,
"points": "txynCl`w{GmBkB{DwD??_SbWaAlAcBnBcDtDcO`Qw@t@??aG~Ge@r@??eImKmBoCqEyH_L_X_GcMQi@_CcKu@sDuBeJ??YSSAaFtAe@DaY[??e@EOKY[gA_CMK{HgAi@KIE]e@cDiFaDgFyDgG??cY~QaC~AaLzH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AwJdFkPbJeHtDgNnHcExBwHfEwLrGiJ`FwI`FoLpGqLlGiSxKyDpBoPpJqPjK{V~OmLlHuSjMgG|DsHzE}FrDeOlJuGxDuM|GcPvHcFdC_A^kHjDoKdFiOfHiGtCuI`E{DbBeFhCmFdCsG|Ce^xP}MnG}G`DqMhGePvHuI~D??oAXaI~Ca@N_@HoB~@kBbA{CtAcPxHeGnC??kDbBeCzAyFbEuAt@YLYHc@DYAiAQ_BIaBAq@Me@[[WOGIKi@u@u@o@gJqFoN{HqBq@kBg@aL_Cm@OaFkAA?mAYuFkAeMkCuD{@mGwAyBo@i@I]OoCy@m@_@gIkBoAKmBYsAG??CVy@rD_BdJ??lCj@??",
"tollCalculation": {
"tolls": [
{
"id": "13",
"name": "Pedágio - Campo Limpo",
"address": "SP 348 - Rod. dos Bandeirantes - Km 39",
"city": "Cajamar",
"state": {
"name": "São Paulo",
"code": "SP"
},
"country": "Brasil",
"concession": "Autoban",
"direction": "NORTH",
"coordinates": {
"latitude": -23.3260346,
"longitude": -46.8231453
},
"serviceTypes": [
{
"serviceId": "48",
"name": "Via Facil"
},
{
"serviceId": "35353480390470101",
"name": "ANTTCODE"
}
],
"price": 47.20
},
{
"id": "73",
"name": "Pedágio - Valinhos Norte",
"address": "SP 330 - Rod. Anhanguera - Km 82 Valinhos",
"city": "Valinhos",
"state": {
"name": "São Paulo",
"code": "SP"
},
"country": "Brasil",
"concession": "Autoban",
"direction": "NORTHWEST",
"coordinates": {
"latitude": -23.01295484,
"longitude": -47.0230555
},
"serviceTypes": [
{
"serviceId": "50",
"name": "Via Facil"
},
{
"serviceId": "35353300820000101",
"name": "ANTTCODE"
}
],
"price": 46.80
}
],
"legTotalCost": 94.00
}
}
],
"freight": {
"source": "RESOLUÇÃO No 5.949, DE 13 DE JULHO DE 2021",
"results": {
"D": {
"4": {
"GRANEL_SOLIDO": {
"value": 265518.68,
"otherCosts": {
"ICMS": 13275.94,
"Lucro": 53103.74,
"TaxaFixa": 500
}
}
}
}
},
"minimumFreight": 265518.68,
"minimumFreightWithCosts": 332398.36
},
"source": "MAPLINK",
"createdAt": "2023-02-07T13:29:07.490396Z",
"expireIn": "2023-02-14T13:29:07.490473Z""
}