1

I am aware about method using admin token

Request type :: GET

URL

http://<host>/rest/V1/orders
?searchCriteria[filterGroups][][filters][][field]=customer_email
&searchCriteria[filterGroups][0][filters][0][value][email protected]

Authentication Bearer <Admin token>

But how to Fetch all specific customer's order using Customer token in magento 2 REST API ?

2
  • You can use integration token or admin token as the acl permission for this is admin or else you can create a new endpoint with customer access. Sep 17, 2018 at 19:00
  • Can you please explain how ? Programmatically in answer. Sep 18, 2018 at 5:57

2 Answers 2

0

Magento is using resource Magento_Sales::sales because of this we can't access it using Customer's token so for the same we need to override Specific API with

<resource ref="self" />

And using this we can access all orders of specific customer using customer's Token in Magento API.

<route url="/V1/orders" method="GET">
        <service class="Magento\Sales\Api\OrderRepositoryInterface" method="getList"/>
        <resources>
            <resource ref="self" />
        </resources>
    </route>
1

Try to follow this blog, you will get all Customer's orders by REST API using the token

http://wikicoode.com/magento2/get-customers-orders-using-magento2-api-rest

2
  • I am aware about method using admin token Oct 24, 2018 at 9:21
  • I want use customer token Oct 24, 2018 at 9:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.