1

Unable to create shipment in Magento 2.2.6

I am using the following source code like this in postman

https://test.com/rest/V1/shipment

{ "entity" : { "order_id" : 70, "items" : [{ "order_item_id" : 94, "qty" : 1 } ], "tracks" : [{ "carrierCode" : "UPS", "order_id" : 70, "title" : "ground", "trackNumber" : "12345678", "parentId" : 1001 } ] } }

Thanks

Rohan Hapani
17.6k9 gold badges57 silver badges99 bronze badges
asked Aug 8, 2019 at 11:48
3
  • this json reponse issue, try with without json format. Commented Aug 8, 2019 at 11:58
  • how can i revert it Commented Aug 8, 2019 at 12:39
  • @shivashankarm is it working for you? Commented Aug 9, 2019 at 8:42

1 Answer 1

1

It seems like your track array field format is wrong. Please try this below :

{ 
 "entity":{ 
 "order_id":70,
 "items":[ 
 { 
 "order_item_id":94,
 "qty":1
 }
 ],
 "tracks":[ 
 { 
 "carrier_code":"UPS",
 "order_id":70,
 "title":"ground",
 "track_number":"12345678",
 "parent_id":1001
 }
 ]
 ],
 }
}

For more reference : Click here


UPDATE :

Go to this path /vendor/magento/framework/DB/Adapter/Pdo/Mysql.php and replace at line no 3036

case 'longtext':
 if (is_array($value)) {
 $value = json_encode($value);
 }
 $value = (string)$value;
 if ($column['NULLABLE'] && $value == '') {
 $value = null;
 }
 break;
answered Aug 8, 2019 at 12:43
6
  • I have tried with above, answer iam getting "message": "Could not save shipment" this error. Commented Aug 8, 2019 at 12:48
  • Please check my updated answer. Commented Aug 8, 2019 at 13:18
  • Hi @Rohan the above fix is for magento2.2.6 version only right? Commented Aug 8, 2019 at 19:33
  • Yes.... You can use in any version. If this error will return. Commented Aug 9, 2019 at 4:07
  • for local system it's working fine without change any code Commented Aug 9, 2019 at 8:44

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.