I'm having a really hard time to retrieve orders by entity_id. I'm calling '/rest/V1/orders' and passing this parameters:
{
'searchCriteria[filter_groups][0][filters][0][field]': 'entity_id',
'searchCriteria[filter_groups][0][filters][0][value]': '1',
'searchCriteria[filter_groups][0][filters][0][condition_type]': 'eq',
'searchCriteria[filter_groups][0][filters][1][field]': 'entity_id',
'searchCriteria[filter_groups][0][filters][1][value]': '2',
'searchCriteria[filter_groups][0][filters][1][condition_type]': 'eq',
'searchCriteria[current_page]': 1,
'searchCriteria[page_size]': 100
}
When trying to do that it results with an empty array. Using only one filters returns a proper order. I also tried using "in" filter
{
'searchCriteria[filter_groups][0][filters][0][field]': 'entity_id',
'searchCriteria[filter_groups][0][filters][0][value]': '1,2',
'searchCriteria[filter_groups][0][filters][0][condition_type]': 'in'
'searchCriteria[current_page]': 1,
'searchCriteria[page_size]': 100
}
Passing params like this result in returning order with ID 1, but no order with ID 2. If I change the order of filter value to '2,1' it returns only order with ID 2.
What am I doing wrong here ? What is the proper way of getting orders from REST API by their IDs ?
Best Answer
The syntax should be like that:
but seems, there are bugs.
https://github.com/magento/magento2/issues/2892
https://github.com/magento/magento2/issues/3411
and
https://github.com/magento/magento2/issues/3018