how can I get all customers from api

ksaleem
Visitor
1 0 0

Hi,

I am new at shopify, I need to get all the customers email who's first name contain "www".  I have more than 4000 customers. I am using following query.

[Storename].myshopify.com/admin/customers/search.json?query=www.cutt&fields=email,id,first_name,last_name 

Regards
Saleem

 

Reply 1 (1)

mashkovtsev
Shopify Partner
38 1 27

Hey @ksaleem 

Search API allows you to do only a full-text search (in all customer fields). In this case, your request URI has to look like this:

 

https://test.myshopify.com/admin/api/2021-07/customers/search.json?query=www&fields=email,id,first_name,last_name 

 

Alternatively, you can do a search in the first name, but it only return results that are full-match to your query (case insensitive). So you will get only customers whose first name is www. The request URI looks like this:

 

https://test.myshopify.com/admin/api/2021-07/customers/search.json?query=first_name:www&fields=email,id,first_name,last_name 

 

Also, keep in mind that customer search API endpoint uses pagination.

All the best.
Alex, Team Lead at Infinite Solutions Shopify Studio
https://inso.codes/