cancel
Showing results for 
Search instead for 
Did you mean: 

Magento REST Web API - How can I obtain all of the Orders for a specific customer?

Magento REST Web API - How can I obtain all of the Orders for a specific customer?

Hello, I'm trying to integrate Magento into an IOS app through the use of the Magento REST Web API. Currently in my program, the user logs in then a customer session token is stored in the application (/rest/V1/integration/customer/token). What I've been trying to figure out is how one would then obtain all Platform Orders/Orders for this specific customer. Reading through the documentation has led me to believe that the only way that this would be possible is to create a custom endpoint. Is there any other way that achieving this would be possible without having to create a custom endpoint or is this the only option. Thanks for the help!

3 REPLIES

Re: Magento REST Web API - How can I obtain all of the Orders for a specific customer?

Hello,

There is API for that.

https://devdocs.magento.com/swagger/

Please check API list.

Check mainly sales API .

Hope it works for you

Re: Magento REST Web API - How can I obtain all of the Orders for a specific customer?

By default, You have to use SearchCriteria interface for Get Customer Specific Order Data in magento 2.

 

 

http://<host>/rest/V1/orders?searchCriteria[filterGroups][][filters][][field]=customer_email&searchCriteria[filterGroups][0][filters][0][value]=someone@test.com

In above query replace customer_email with your customer email and someone@test.com with your email id.

 

Already one user have asked question like you,

https://community.magento.com/t5/Magento-2-x-Technical-Issues/Get-all-orders-a-customer-has-made-wit...

 

 

But you can check other sales and customer API in Magento swagger,

https://devdocs.magento.com/swagger/

Thanks.

If Issue Solved, Click Kudos/Accept As solutions.

Re: Magento REST Web API - How can I obtain all of the Orders for a specific customer?

Hi @gabriel_kb

 

Yes , you can get specific customer orders using rest api !! you need to pass that in searchcriteria api !

 

Magento 2 have one mechanism to get filtered data using SearchCriteria property in REST API.

 

Below is the end point - if you wanted to get specific customer order data.

 

 

https://domain.com/index.php/rest/V1/orders?searchCriteria[filter_groups][0][filters][0][field]=customer_email&searchCriteria[filter_groups][0][filters][0][value]=aaa@gmail.com

 

Where you need to pass - your customer 's email id instead of aaa@gmail.com

 

same way like others api you are calling - you need to pass its access token for the same.

 

Hope it helps to you !!

if issue solved,Click Kudos & Accept as Solution