0

How can I add a new tracking number to an already existing shipment that was created using the following endpoint https://magento.redoc.ly/2.4.0-admin/tag/orderorderIdship ?

I can create the shipment for a sale/order with the initial tracking number/s, but if I use the same endpoint from above to add a new tracking number for the same order/sale, I get the following error: "you can't create a shipment without products"

Which endpoint should I use? Is it this one https://magento.redoc.ly/2.4.0-admin/tag/shipmenttrack or https://magento.redoc.ly/2.4.0-admin/tag/shipment#operation/salesShipmentRepositoryV1SavePost or some other? The documentation for magento is confusing for me, especially as I am a beginner in magento.

Thank you

2 Answers 2

1

If you look at that shipment section from documentation, it seems that once the shipments has been created with all the products to ship, you won't be able to update the tracking number or append a new tracking number, instead you'll have delete the shipment track and create a new one.

/rest/default/V1/shipment/track/{id}, this deletes the track ID

also refer here https://devdocs.magento.com/swagger

Sign up to request clarification or add additional context in comments.

Comments

0

There is an endpoint for adding tracking to existing shipments. https://devdocs.magento.com/redoc/2.2/#tag/shipmenttrack/operation/salesShipmentTrackRepositoryV1SavePost

Send a post request to {{baseUrl}}/V1/shipment/track containing the following will add tracking information to shipment 26 in order 29.

{
  "entity": {
    "order_id": 29,
    "parent_id": 26,
    "carrier_code": "United Parcel Service",
    "track_number": "abcdefghijklmno",
    "title": "United Parcel Service"
  }
}

I tested the above with Magento 2.4 but the docs look the same as for version 2.2

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.