How to Create Shipment using Magento 2 API?
In this article, we will learn about how to create Shipment using Magento 2 API.
- Using API, we can create shipment of an order easily and quickly in Magento 2.
- First, you have to find orderid for which order you want to create shipment.
- For creating shipment, you must have atleast one order item in your order table.
- You just need to pass {host/rest/V1/order/orderId/ship} this URL in swagger or postman with POST method.
orderId : set order id.
Create a Shipment Using REST API Magento 2
- Before run this URL, you have to select bear token from Authorization.
- Make sure to run this URL you have to enter your access token from backend like this:
"BearToken " : <Place Your Access Token>
{ "appendComment": true, "notify": true, "comment": { "comment": "shipment created Successfully" }, "tracks": [ { "track_number": "3SCEMW182389201", "title": "UPS", "carrier_code": "Carrier code" } ] } |
appendComment : true/false . for append comment in notify mail.
notify : true/false . To notify customer by shipment mail.
tracks : to add shipment tracking details.
After run this URL you can find shipment details in sales_shipment table in database and also in backend Navigate to Sales -> Shipment.
Conclusion:
Using above article, you can easily create shipment with Magento 2 REST API. If you have any query regarding above code implementation then you can contact us or let us know in comment section.