Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Customer REST API, query:state:enabled not working?

Solved

Customer REST API, query:state:enabled not working?

mike_toxicfox
Shopify Partner
2 0 0

Hey,

Trying to retrieve a list of all "enabled" customers using the REST API.

The API docs imply that I should be able to query the API to return on the accounts where the state = "enabled"

"/admin/api/2021-01/customers.json?query=state:enabled"

However, the results returned are unfiltered and are returning all accounts.

Does anyone know if this is broken, or a suitable work-around where I don't have to fetch ALL customers and filter them manually?

Accepted Solution (1)

Gregarican
Shopify Partner
1033 86 293

This is an accepted solution.

What happens when you modify the URI to end with /customers.json?state=enabled instead?

View solution in original post

Replies 3 (3)

Gregarican
Shopify Partner
1033 86 293

This is an accepted solution.

What happens when you modify the URI to end with /customers.json?state=enabled instead?

mike_toxicfox
Shopify Partner
2 0 0

🤦 That works!

Thank you - I'm happy I've got it working, but sad the docs aren't accurate.

Gregarican
Shopify Partner
1033 86 293

The query parameter format you were using looks more along the lines of how it's used in the GraphQL API. The REST API is more straightforward in how it just uses the more traditional ?thisField=thisValue&thisOtherField=thisOtherValue. Glad it's working for you!