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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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