In Magento1x we need to do make different api calls to create shipment and add tracking numbers to that shipment. In Magento 2x REST documentation it appears I could do both using the single POST api call. When i tried it was not allowing the tracks to have in the shipmentData then what is the purpose of having the tracks and Comments information in that API. Did anyone tried this?
1 Answer
If you are shipping all items in the order, there is no need to actually include the items:
{
"tracks": [
{
"track_number": "1Y-9876543210",
"title": "Custom",
"carrier_code": "SomeCarrierCode"
}
]
}
As long as you have the Magento order ID in the URL rest/V1/order/10/ship
, this will work. Plus, the carrier_code
can be anything if you haven't got real carriers setup...
This took me hours to find out, as Magento's documentation and API is shocking!