Once you get an order notification, you obtain the data pertaining to it as usual, for example through one of the following API calls (here exemplified using "curl"):
Specific order:
curl -X GET https://api-cbt.mercadolibre.com/api/orders/DMX1858967748?access_token=XXXXXX
Last x day's orders (in this example x = 20):
curl -X GET https://api-cbt.mercadolibre.com/api/orders/search/?days=20&status=confirmed&page=1&access_token=XXXXXX
You will get your order details in the response (this is a reduced version of the response):
{
"orders": [
{
...
"order_id": "DMX1858967748",
"payment_status": "confirmed",
"product": [
{
"SKU": "Example_sku",
"mpid": 9011490570,
"quantity": 1,
...
}
],
...
"shipment_label_location": null,
"status": "confirmed"
}
]
}
With data from this response you can complete the request to create the shipment and send the tracking information.
curl -X POST -H "Content-type:application/json" -d '{
"order_id": "DMX1858967748",
"shipment_details": {
"product": [{
"mpid": "9011490570",
"quantity": 1
}],
"tracking_id": "example-tracking-number",
"tracking_url": "https://www.example-tracking-page.com/example-tracking-number",
"carrier": "Example-Carrier"
}
}' https://api-cbt.mercadolibre.com/api/shipments?access_token=XXXXX
Here the order_id, mpid and quantity can be found in the response from step 1.
The "tracking_id", "tracking_url" and "carrier" is the data you have to supply in order to create the shipment.
It is important that the tracking_url is fully functional- i.e., it must link directly to the tracking page of the carrier for the package.
you will obtain a response confirming the creation of the shipment:
{
"shipment_details": {
"carrier": "Example-Carrier",
"international_tracking_url": "cbt.mercadolibre.com/trk/DMX1858967748",
"product": [
{
"SKU": "Example-sku",
"mpid": 9011490570,
"product_title_english": "Example-product",
"quantity": 1
}
],
"shipment_id": 702495,
"shipment_status": "shipped_to_warehouse",
"tracking_id": "example-tracking-number",
"tracking_url": "https://www.example-tracking-page.com/example-tracking-number"
}
}