I am trying to get the order list using the below url,
GET METHOD - http://magento.local/index.php/rest/V1/orders?searchCriteria
Header: Authorization: Bearer TOKEN(Customer Token)
But its giving the following response,
{
"message": "Consumer is not authorized to access %resources",
"parameters": {
"resources": "Magento_Sales::sales"
}
}
what needs to be done to get the order list using customer token?
3
Answers
Unfortunately it’s not implemented in Magento_Sales::sales yet, but you can extend your own API. follow the following issue:
https://github.com/magento/magento2/issues/3552
For the get Customer Order history use
searchCriteria
and passedcustomer_email
id.Follow below Magento 2 API to get the customer order history.
Response:
Magento default order API authenticate with admin.
If you want to authenticate with customer.
Please just create a new custom module and then create your own new API end-point.
Add your new api end-point in
VenderModuleetcwebapi.xml
file.now you can use url
http://magento.local/index.php/rest/V1/ca-orders?searchCriteria
with customer auth token.Thank You!