Ad

Shopify API - Select All The Customer Based On Tags?

- 1 answer

We have defined all the customers in our shopify store with different tags like "Price Level 1", "Price Level 2", "Price Level 3" ---- so on till "Price Level 16" and new customer are without any tag. Through the shopify API I want to fetch customers based on there tag, I tried different URL

https://apikey:[email protected]e/admin/customers.json?tags:Price Level 1 
https://apikey:[email protected]/admin/customers.json?tags="Price Level 1" 
https://apikey:[email protected]/admin/customers.json?query=Price Level 1 

but all the URL give me the same Result i.e customer with any tag. Please guide me with the best way through which I can fetch the customer based on exact tag name and also how can I fetch the customer without any tag.

Ad

Answer

To apply a query you need to use the search endpoint:

 https://store.myshopify.com/admin/customers/search.json?query=%27Price%20level%201%27

Note when your tags have spaces you have to include quotes in the query. If you are using Node then the easiest way to get this is

escape("'Price Level 1'");
Ad
source: stackoverflow.com
Ad