簡體   English   中英

與其他資源(產品,訂單等)不同,Shopify API客戶的排序不正確

[英]Shopify API Customer sort incorrectly unlike other resources(Product, Order, etc)

我正在使用Shopify API構建shopify應用,但遇到了麻煩。

當我使用'/admin/customers.json'發出GET請求時,與其他資源(產品,訂單等)不同,Shopify API響應的結果排序不正確

我做了一些截圖以使事情變得清晰。

在此處輸入圖片說明

在此處輸入圖片說明

不是order_by Updated_at desc

訂單和產品都響應了正確的收款結果(“ updated_at desc”),但客戶沒有。

是bug還是我錯過了什么?

我認為您需要對參數進行編碼。 Shopify文檔為了清晰起見沒有顯示編碼的參數,但是您需要:

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

您可以在客戶上使用搜索端點。

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

與客戶在同一API頁面上查看文檔,再下一層

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

搜索時,請使用“ sorty_by”屬性: https ://shopify.github.io/js-buy-sdk/api/classes/ShopClient.html#method-fetchQueryCollections

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM