I'm using the api to extract order data, then I want to Update the order Status to something else eg. Status = Complete.
I only want to update the status, without affecting the rest of the order data. Is this possible?
My code is below, however weird things are happening to the order, missing products, extra products.
I'm new to the api and curl. Have I done something wrong in my code? is it even possible to do?
$query_string = "/orders/".$order['order_id']; $order_data = json_encode(array('status' => 'C') ); $ch = curl_init(); curl_setopt($ch, CURLOPT_USERPWD, $email . ":" . $api_key); curl_setopt($ch, CURLOPT_URL, $myUrl.$query_string); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS,$order_data); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: ' . strlen($order_data)) ); $update = curl_exec($ch);