skip to Main Content

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


  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

    Login or Signup to reply.
  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search