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

3
  • this json reponse issue, try with without json format. Aug 8, 2019 at 11:58
  • how can i revert it Aug 8, 2019 at 12:39
  • @shivashankarm is it working for you? 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;
6
  • I have tried with above, answer iam getting "message": "Could not save shipment" this error. Aug 8, 2019 at 12:48
  • Please check my updated answer. Aug 8, 2019 at 13:18
  • Hi @Rohan the above fix is for magento2.2.6 version only right? Aug 8, 2019 at 19:33
  • Yes.... You can use in any version. If this error will return. Aug 9, 2019 at 4:07
  • for local system it's working fine without change any code Aug 9, 2019 at 8:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.