Not familiar with whatever wrapper you're using so I don't know what it's actually returning in $get_order. But if you get a specific order via the api by using "orders/123" and then json_decode() the result, you should have a 'products' array that contains the products from the order. You can then look a that to see how to reference the product_id.
Note that casting an array to a StdClass kind of defeats the purpose of doing a json_decode($get_order,true). (and make sure you use true as the 2nd argument to json_decode.) Instead you should assume that $obj is an array(). But if you want to use it as an object, you will most likely have to cast your $obj->status to a string.
i just do it like this..
$get_order = callAPI('GET', 'https://www.test.com/api/orders/'.$WO, json_encode($result, true)); $obj = json_decode($get_order); foreach ($obj->products as $products) { $item_id = $products->{'item_id'}; $amount = $products->{'amount'}; } //and then i request a POST $data_shipment = array( "carrier" => "", "order_id" => $WO, "products" => array( $item_id => $amount, ), "shipping" => $M, "shipping_id" => $CSCOURIER, "user_id" => "0", "tracking_number" => $V ); $update_shipment = callAPI('POST', 'https://www.test.com/api/shipments', json_encode($data_shipment));
Thank you for your help.