Magento2: Customer Search by ID does not work in REST API

Created on 22 Nov 2016  路  4Comments  路  Source: magento/magento2

I have a list of customers that I am trying to pull data for all at once. I build a search filter with the contion_type="in", field="id", and value=my list of customers. I get an error that the field id does not exist.

Preconditions

  1. Magento 2.1.2
  2. REST API

Steps to reproduce

  1. Acquire token for token-based REST authorization
  2. Make GET request to /rest/V1/customers/search?searchCriteria[filter_groups][0][filters][0][field]=id&searchCriteria[filter_groups][0][filters][0][value]=1,2&searchCriteria[filter_groups][0][filters][0][condition_type]=in

Expected result

  1. This should return a list of customers with an id in {1,2}

Actual result

{
"message": "Invalid attribute name: %1",
"parameters": [
"id"
]
}

I have tried other terms for id, such as customer_id, customerID, custID, etc. with no change.

FrameworWebapi Format is valid bug report

Most helpful comment

Instead of field 'id' try 'entity_id'

All 4 comments

Instead of field 'id' try 'entity_id'

@mikeweis That worked, thanks.

This gives the result for first search id only. For example is i uses the search term searchCriteria[filter_groups][0][filters][0][value]=1,2 Then it returns the result for id 1 only.

But in api you returns id, not entity_id, so why ask about entity_id?

Was this page helpful?
0 / 5 - 0 ratings