Skip to main content

Freight API Integration

We make it available for sellers to have freight calculations performed through freight gateways. This allows logistics partners to develop the integration with ANYMARKET.

When this implementation is enabled, ANYMARKET will start making calls to the freight partner's URL, and if the freight API responds within an acceptable time (up to 250ms), ANYMARKET will send that data to the Marketplace.

What does the integrator need to develop?​

Flow: Freight Query​

When your integration is enabled with ANYMARKET, and there is a freight query in the Marketplace, we will make a POST call to the endpoint provided in the system parameters, sending a JSON in the following format as the request body:

[POST] http://endereco.frete.com.br
{
"zipCode" : "87100000",
"marketplace": "Mercado Livre",
"products" : [
{
"sku" : "A1512",
"height" : 10,
"width" : 20,
"weight" : 20,
"length" : 20,
"amount" : 1,
"value" : 149.90,
"originZipCode" : null
},
{
"sku" : "B1510",
"height" : 20,
"width" : 35,
"weight" : 35,
"length" : 10,
"amount" : 2,
"value" : 299.90,
"originZipCode" : "87100000",
"metadata": {
"idInMarketplace" : "MLB1039413643",
"official_store_id" : "224"
}
}
]
}

The freight types accepted by ANYMARKET are NORMAL and EXPRESSA. As a response, ANYMARKET expects a JSON in the following format:

Exemplo de resposta
{
"items" : [
{
"serviceName" : "Transporte Terrestre",
"carrierName" : "Seller Transporte",
"deliveryTime" : 12,
"price" : 23.99,
"freightType" : "NORMAL"
},
{
"serviceName" : "SEDEX",
"carrierName" : "Seller Transporte",
"deliveryTime" : 6,
"price" : 35.90,
"freightType" : "EXPRESSA"
}
]
}

Only one record should be returned for each Carrier x Freight Type combination. That is, two records for the same carrier with the freight type NORMAL should not be returned, for example.

The image below shows how the freight query flow is performed, from the marketplace call to the return of the result.

apifrete.png

warning

Attention!​

If an empty array is returned in the response JSON, ANYMARKET will check if there is any freight value configured within the system itself. If there is, it will return the value configured in the system to the marketplace; otherwise, it will be returned that for that particular quote, there is no freight available to fulfill the delivery.

Flow: Collection Creation​

ANYMARKET has an event notification feature: when an event occurs, for example when an order status is modified, we will notify your application.

To receive notifications from ANYMARKET, your application must accept POST requests in JSON format. Notifications will be sent in the following format:

{
"type" : "ORDER",
"content" : {
"id":"10",
"oi":"99999."
}
}

After being notified, your application must perform a GET of the order in ANYMARKET to absorb all the sales information.

How to enable the integration?​

To enable freight calculation via API, the seller must access the ANYMARKET parameters screen, select the freight calculation by API option and enter the API URL as illustrated in the following image.

parametro frete.png

To enable order notifications, the seller must access the ANYMARKET parameters screen, go to the "Callbacks" menu and enter the logistics partner's Callback, as illustrated below:

55.png