Guys I want to update order status using API. I am using this api to change the order status but it's not working:
http://dev-jawed.com/index.php/rest/V1/orders
{
"status" : "Out-for-delivery",
"entity" : 1,
"items": {
"order_id" : 1
}
}
Any help will be appreciated.
3 Answers 3
I think a better answer is to use the following api entry point
("/rest/V1/orders/{orderId}/comments", Method.POST);
pass the StatusHistory object in the post body, setting the appropriate fields to update the order status.
{
"statusHistory": {
"comment": "string",
"createdAt": "string",
"entityId": 0,
"entityName": "string",
"isCustomerNotified": 0,
"isVisibleOnFront": 0,
"parentId": 0, <-- This is the Order ID
"status": "string",
"extensionAttributes": {}
}
}
-
FYI: not all of the fields are required, you can read which ones are required in the documentationSebastian– Sebastian2019年11月15日 16:59:14 +00:00Commented Nov 15, 2019 at 16:59
-
When i am using this api order state is not changing can plz adviseNagaraju Kasa– Nagaraju Kasa2021年10月26日 14:53:51 +00:00Commented Oct 26, 2021 at 14:53
-
As @Sebastian said above, but new link here: magento.redoc.ly/2.3.7-admin/tag/ordersidcomments#operation/…srokatonie– srokatonie2022年06月15日 14:31:45 +00:00Commented Jun 15, 2022 at 14:31
If you look at the swagger api documents (either on your local machine at /swagger or at the devdocs). You should find the API V1/orders. If you are using your local version you will also have the button to try to calls direct from swagger which is nice for debugging. From looking through the documents you should be able to post something like the following to the api.
{
"entity": {
"entity_id": 0,
"status": "string"
}
}
Remember to replace the entity_id with the correct order id and the status with the status you would like to change to.
-
This will create problems with increment_id (as experienced in Magento 2.2) - order's increment id will be changed (from scope 1 1000000005, to scope 0 (admin) 000000008).epson121– epson1212018年01月04日 12:43:36 +00:00Commented Jan 4, 2018 at 12:43
-
@David Manners, is there any pattern that we can update staus more than one order in a single API call?Jigar Dhaduk– Jigar Dhaduk2019年07月26日 09:14:47 +00:00Commented Jul 26, 2019 at 9:14
You can do this:
PUT /V1/orders/create
'entity' => [
'entity_id'=> 1,
'increment_id' => '000000001',
'status'=> 'processing',
]
You currently (v 2.1.*) get the same result with calls:
PUT /V1/orders/create
POST /V1/orders
-
Is there any pattern that we can update staus more than one order in a single API call?Jigar Dhaduk– Jigar Dhaduk2019年07月26日 09:13:47 +00:00Commented Jul 26, 2019 at 9:13