2

How we can create shipment of a order using rest api.

asked Jun 26, 2019 at 11:42
3

3 Answers 3

2

Api Link : {base_url}/index.php/rest/default/V1/order/291/ship Order ID and increment ID is not same

Here 291 is order_id not a Increment Id

Sample Body:

{
"items": [
 {
 "order_item_id": 2448,
 "qty": 1
 },
 {
 "order_item_id": 2449,
 "qty": 1
 }
]
}

You can get "order_item_id" from fetching order info through API. Hope it helps !!

answered Jun 26, 2019 at 12:01
1
  • so 2448 should be simple or configurable product id if we use configurable products. Commented Jun 26, 2019 at 13:03
2

I have researched on this and found an answer.

URL : http://domain/rest/V1/order/237/ship -:- where 237 is the order id

Method: post

Input Parameters :

{
 "items": [
 {
 "order_item_id": 623,
 "qty": 1
 }
 ],
 "notify": true,
 "appendComment": true,
 "comment": {
 "extension_attributes": {},
 "comment": "comment on shipment",
 "is_visible_on_front": 1
 },
 "tracks": [
 {
 "track_number": "123456",
 "title": "fedex Shipment",
 "carrier_code": "fedex"
 }
 ]
}

This will create shipment and notify the customer also.

answered Jun 27, 2019 at 5:59
1

If you have configurable products, please use simple item’s parent_item_id field. It is unique id even the simple product is under same configurable product.

item_id": 1518, "name": "IVORY LONGLINE TEE S", "no_discount": 0, "order_id": 534, "original_price": 0, "parent_item_id": 1515,

Thanks

answered Aug 19, 2021 at 12:35
1
  • WOW, totally insane! Why it's like that? Of course not blaming you but Magento developers... Commented Jul 20, 2023 at 15:16

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.