Home Magento REST API tracking number not being updated
Reply: 0

Magento REST API tracking number not being updated

amar deep
1#
amar deep Published in 2018-01-12 12:53:55Z

I am using Magento 2.2.2 version. I am trying to update tracking information through their rest API. Here is my code:

$tracking_str   =   
        '{
         "items": [
            {
              "extension_attributes": {},
              "order_item_id": "'.$orderItemId.'",
              "qty": "'.$qty_invoiced.'"
            }
          ],
          "notify": false,
          "appendComment": true,
          "comment": {
            "extension_attributes": {},
            "comment": "Item(s) has been shipped",
            "is_visible_on_front": 0
          },
          "tracks": [
            {
              "extension_attributes": {},
              "track_number": "'.$TrackingNumber.'",
              "title": "'.$ShipTitle.'",
              "carrier_code": "'.$carrierCode.'"
            }
          ],
          "packages": [
            {
              "extension_attributes": {}
            }
          ],
          "arguments": {
            "extension_attributes": {}
          }

        }';

I am passing the above things to php curl and for the first time, I am getting a response of shipment id. And the Order status is changing to 'complete' over the Magento API. However, tracking information like carrier code and tracking number are not being updated. When I run the code again, I am getting response as:

 res is: stdClass Object
(    [message] => Shipment Document Validation Error(s):
The order does not allow a shipment to be created.
You can't create a shipment without products.
)

I don't know, where I am going wrong.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.300917 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO