Magento 2 REST API – Get Pending Orders for Specific Customer

apimagento2rest

I am trying to get the pending orders for a specific customer using :

https://{domain.com}/index.php/rest/V1/orders?searchCriteria[filter_g‌​roups][0][filters][0‌​][field]=status&searchCriteria[filter_groups][0][filters][0][value]=pending&
searchCriteria[filter_groups][0][filters][0][condition_type]‌​=eq&searchCriteria[filter_groups][0][filters][0][field]=customer_email&searchCriteria[filter_groups][0][filters][0][value]=aaa@gmail.com

But I got this error :

Report ID: webapi-58e37396d92a8; Message: Property "FilterG‌​roups"
does not have corresponding setter in class
"Magento\Framework\Api\SearchCriteria". in
/var/www/html/lib/internal/Magento/Framework/Webapi/ErrorProcessor.php:195

How can I fix it?

-Another question, This API forces me to use an Admin token. I see it is not security wise. How can I use a customer token ?

Best Answer

https://domain.com/index.php/rest/V1/orders?searchCriteria[f‌​ilter_groups][0][fil‌​ters][0][field]=cust‌​omer_email&searchCri‌​teria[filter_groups]‌​[0][filters][0][valu‌​e]=aaa@google.com&se‌​archCriteria[filter_‌​groups][0][filters][‌​0][condition_type]=e‌​q&searchCriteria[fil‌​ter_groups][1][filte‌​rs][0][field]=status‌​&searchCriteria[filt‌​er_groups][1][filter‌​s][0][value]=pending‌​&searchCriteria[filt‌​er_groups][1][filter‌​s][0][condition_type‌​]=eq

Related Topic