I want to update order status/state usging webapi
here is my testing code :
$data = [ 'entity' => [ 'entity_id'=>37, 'state'=>'processing', 'status'=>'payment_finished', ] ]; $ch = curl_init(); $post = json_encode($data); $site_path = $localurl."/index.php/rest/V1/orders'; $authorization = "Authorization: Bearer $token"; curl_setopt($ch, CURLOPT_URL, $site_path); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json' , $authorization )); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS,$post); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); $result = curl_exec($ch);
and when this code runs, the state and status updated correctly , but the increment_id changed from previous to '00000001' .
Can anyone help me with this problem?
I'm also facing the same issue. When we pass the increment_id along with the entity_id then it updates correctly without new increment_id
You have to pass 'increment_id' in BODY post data like below
$data = [ 'entity' => [ 'entity_id'=>37,
'increment_id'=>00000001, 'state'=>'processing', 'status'=>'processing', ] ];
You have to pass 'increment_id' in BODY post data like below
$data = [
'entity' => [
'entity_id'=>37,
'increment_id'=>00000001,
'state'=>'processing',
'status'=>'processing',
]
];
Hello, In this code I have find one error is coming like:
in this line: $authorization = "Authorization: Bearer $token";
syntax error, unexpected 'Authorization'