Hello, Magento pals!

Magento 2 is a flexible, powerful E-commerce platform that enables the user to create shipping of an order with the use of API. hence, I am here with this complete tutorial on how you can create shipping with Magento 2 API.

Let’s get going!

Create Shipment With Magento 2 REST API

Get the order_item_id of all the products that are to be shipped in order to create a shipment with Magento 2. Note that:

  • To create a partial shipment, define only the order_item_ids that are going to be shipped now. 
  • If the call is successful on a full shipment, The order status is changed to Complete.

Endpoint:

POST https://domain.com/rest/<store_code>/V1/order/1/ship

Here, 1 is Your Order Id and store_code (optional).

Headers:

Content-Type: application/json

Authorization: Bearer <administrator token>

Payload:

Response:

The shipment ID, such as 3.

Check the results

  1. Go to Sales > Shipments in the admin panel. The Three shipments for this order are displayed in the grid.
  2. Go to Catalog > Products. Check that the Quantity per Source values are correct for each product, based on the selections you made at shipment.

Create Sample Example for shipment using  REST API so create shipment_rest_api.php in your Magento root path after adding the below code.

After adding the above code, run the below URL to check shipment was created or not.

http://domain.com/shipment_rest_api.php

Bottom Line

The aforementioned are the comprehensive details on How to Create Shipment With Magento 2 API. we anticipate that this blog post was a beneficial one for what you were looking for. 

If you have any complications or want to talk about something relevant to this problem, please write us in the comments below. I look forward to hearing from you!

Happy Coding!

Click to rate this post!
[Total: 3 Average: 5]