Skip to main content
deleted 497 characters in body
Source Link

I need to add carrier code and tracking number to the shipment by REST API.

For this, I am trying 2 different codes which I found from the search as below. But it doesn't update anything, not display any error and return the same array.

  1. I don't know what should be order_id, parent_id and entity_id. I am using different ids from the order and shipment URL.

     $shiptrack = [
     "entity" => [
     "order_id" => 6298,
     "parent_id" => 6298,
     "entity_id" => 12594,
     "weight"=> 0,
     "qty"=> 0,
     "description"=> "Tracking code Description",
     "track_number"=> "1234567",
     "title"=> "Custom Tracking Code",
     "carrier_code"=> "custom"
     ]
     ];
    

2.Tried all ids from the order and shipment URL.

$shiptrack = [ 
"items"=> [ 
        [ 
            "order_item_id"=>5813, 
            "qty"=> 0 
        ] 
    ], 
"notify" => true, 
"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 
        ] 
    ] 
];

UPDATED: The answer of Abdul is worked. And in the result array, I got a new attribute entity_id as below. What is that?

Array
(
[order_id] => 6298
[created_at] => 2019-08-01 11:00:16
[entity_id] => 472
[parent_id] => 5813
[updated_at] => 2019-08-01 11:00:16
[weight] => 0
[qty] => 0
[description] => Tracking code Description
[track_number] => 1234567
[title] => Custom Tracking Code
[carrier_code] => custom
)

I need to add carrier code and tracking number to the shipment by REST API.

For this, I am trying 2 different codes which I found from the search as below. But it doesn't update anything, not display any error and return the same array.

  1. I don't know what should be order_id, parent_id and entity_id. I am using different ids from the order and shipment URL.

     $shiptrack = [
     "entity" => [
     "order_id" => 6298,
     "parent_id" => 6298,
     "entity_id" => 12594,
     "weight"=> 0,
     "qty"=> 0,
     "description"=> "Tracking code Description",
     "track_number"=> "1234567",
     "title"=> "Custom Tracking Code",
     "carrier_code"=> "custom"
     ]
     ];
    

2.Tried all ids from the order and shipment URL.

$shiptrack = [ 
"items"=> [ 
        [ 
            "order_item_id"=>5813, 
            "qty"=> 0 
        ] 
    ], 
"notify" => true, 
"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 
        ] 
    ] 
];

UPDATED: The answer of Abdul is worked. And in the result array, I got a new attribute entity_id as below. What is that?

Array
(
[order_id] => 6298
[created_at] => 2019-08-01 11:00:16
[entity_id] => 472
[parent_id] => 5813
[updated_at] => 2019-08-01 11:00:16
[weight] => 0
[qty] => 0
[description] => Tracking code Description
[track_number] => 1234567
[title] => Custom Tracking Code
[carrier_code] => custom
)

I need to add carrier code and tracking number to the shipment by REST API.

For this, I am trying 2 different codes which I found from the search as below. But it doesn't update anything, not display any error and return the same array.

  1. I don't know what should be order_id, parent_id and entity_id. I am using different ids from the order and shipment URL.

     $shiptrack = [
     "entity" => [
     "order_id" => 6298,
     "parent_id" => 6298,
     "entity_id" => 12594,
     "weight"=> 0,
     "qty"=> 0,
     "description"=> "Tracking code Description",
     "track_number"=> "1234567",
     "title"=> "Custom Tracking Code",
     "carrier_code"=> "custom"
     ]
     ];
    

2.Tried all ids from the order and shipment URL.

$shiptrack = [ 
"items"=> [ 
        [ 
            "order_item_id"=>5813, 
            "qty"=> 0 
        ] 
    ], 
"notify" => true, 
"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 
        ] 
    ] 
];
added 499 characters in body
Source Link

I need to add carrier code and tracking number to the shipment by REST API.

For this, I am trying 2 different codes which I found from the search as below. But it doesn't update anything, not display any error and return the same array.

  1. I don't know what should be order_id, parent_id and entity_id. I am using different ids from the order and shipment URL.

     $shiptrack = [
     "entity" => [
     "order_id" => 6298,
     "parent_id" => 6298,
     "entity_id" => 12594,
     "weight"=> 0,
     "qty"=> 0,
     "description"=> "Tracking code Description",
     "track_number"=> "1234567",
     "title"=> "Custom Tracking Code",
     "carrier_code"=> "custom"
     ]
     ];
    

2.Tried all ids from the order and shipment URL.

$shiptrack = [ 
"items"=> [ 
        [ 
            "order_item_id"=>5813, 
            "qty"=> 0 
        ] 
    ], 
"notify" => true, 
"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 
        ] 
    ] 
];

UPDATED: The answer of Abdul is worked. And in the result array, I got a new attribute entity_id as below. What is that?

Array
(
[order_id] => 6298
[created_at] => 2019-08-01 11:00:16
[entity_id] => 472
[parent_id] => 5813
[updated_at] => 2019-08-01 11:00:16
[weight] => 0
[qty] => 0
[description] => Tracking code Description
[track_number] => 1234567
[title] => Custom Tracking Code
[carrier_code] => custom
)

I need to add carrier code and tracking number to the shipment by REST API.

For this, I am trying 2 different codes which I found from the search as below. But it doesn't update anything, not display any error and return the same array.

  1. I don't know what should be order_id, parent_id and entity_id. I am using different ids from the order and shipment URL.

     $shiptrack = [
     "entity" => [
     "order_id" => 6298,
     "parent_id" => 6298,
     "entity_id" => 12594,
     "weight"=> 0,
     "qty"=> 0,
     "description"=> "Tracking code Description",
     "track_number"=> "1234567",
     "title"=> "Custom Tracking Code",
     "carrier_code"=> "custom"
     ]
     ];
    

2.Tried all ids from the order and shipment URL.

$shiptrack = [ 
"items"=> [ 
        [ 
            "order_item_id"=>5813, 
            "qty"=> 0 
        ] 
    ], 
"notify" => true, 
"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 
        ] 
    ] 
];

I need to add carrier code and tracking number to the shipment by REST API.

For this, I am trying 2 different codes which I found from the search as below. But it doesn't update anything, not display any error and return the same array.

  1. I don't know what should be order_id, parent_id and entity_id. I am using different ids from the order and shipment URL.

     $shiptrack = [
     "entity" => [
     "order_id" => 6298,
     "parent_id" => 6298,
     "entity_id" => 12594,
     "weight"=> 0,
     "qty"=> 0,
     "description"=> "Tracking code Description",
     "track_number"=> "1234567",
     "title"=> "Custom Tracking Code",
     "carrier_code"=> "custom"
     ]
     ];
    

2.Tried all ids from the order and shipment URL.

$shiptrack = [ 
"items"=> [ 
        [ 
            "order_item_id"=>5813, 
            "qty"=> 0 
        ] 
    ], 
"notify" => true, 
"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 
        ] 
    ] 
];

UPDATED: The answer of Abdul is worked. And in the result array, I got a new attribute entity_id as below. What is that?

Array
(
[order_id] => 6298
[created_at] => 2019-08-01 11:00:16
[entity_id] => 472
[parent_id] => 5813
[updated_at] => 2019-08-01 11:00:16
[weight] => 0
[qty] => 0
[description] => Tracking code Description
[track_number] => 1234567
[title] => Custom Tracking Code
[carrier_code] => custom
)
Source Link

Magento 2.3 REST API: How to update shipment?

I need to add carrier code and tracking number to the shipment by REST API.

For this, I am trying 2 different codes which I found from the search as below. But it doesn't update anything, not display any error and return the same array.

  1. I don't know what should be order_id, parent_id and entity_id. I am using different ids from the order and shipment URL.

     $shiptrack = [
     "entity" => [
     "order_id" => 6298,
     "parent_id" => 6298,
     "entity_id" => 12594,
     "weight"=> 0,
     "qty"=> 0,
     "description"=> "Tracking code Description",
     "track_number"=> "1234567",
     "title"=> "Custom Tracking Code",
     "carrier_code"=> "custom"
     ]
     ];
    

2.Tried all ids from the order and shipment URL.

$shiptrack = [ 
"items"=> [ 
        [ 
            "order_item_id"=>5813, 
            "qty"=> 0 
        ] 
    ], 
"notify" => true, 
"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 
        ] 
    ] 
];