1
votes

I am building a shopify app by using the Shopify API, and run into trouble.

When I make a GET request with '/admin/customers.json' Shopify API response with results sort incorrectly unlike other resources(Product, Order, etc)

I make some screenshots to get thething clear.

enter image description here

enter image description here

not order_by updated_at desc

Both Order and Product reponse with the correct collection result("updated_at desc") but Customer didn't.

Is it bug or did I miss anything?

3
Yep. I just came across the same bug. Although, technically, this 'order' field is not documented anywhere as far as I can see... Did you end up finding a solution?Clement

3 Answers

0
votes

I think you need to encode your parameters. Shopify docs don't show encoded params for clarity but you need:

'?fields='+encodeURIComponent('id,updated_at')+
'&updated_at_min='+encodeURIComponent('2015-11-25 20:01:00')+
'&order='+ encodeURIComponent('updated_at DESC');
0
votes

You could use the search endpoint on customer.

/admin/customers/search.json
/admin/customers/search.json?order=updated_at DESC&fields=id

See the doc on the same API page as customer, just a bit further down the page

https://docs.shopify.com/api/customer