【问题标题】:Shopify API - Select all the customer based on tags?Shopify API - 根据标签选择所有客户?
【发布时间】:2016-04-27 15:59:31
【问题描述】:

我们已经用不同的标签定义了我们shopify商店中的所有客户,例如“Price Level 1”、“Price Level 2”、“Price Level 3”----等等,直到“Price Level 16”和新客户是没有任何标签。通过我想根据那里的标签获取客户的 shopify API,我尝试了不同的 URL

https://apikey:password@hostname/admin/customers.json?tags:Price Level 1 
https://apikey:password@hostname/admin/customers.json?tags="Price Level 1" 
https://apikey:password@hostname/admin/customers.json?query=Price Level 1 

但所有 URL 都给我相同的结果,即带有任何标签的客户。请指导我根据确切的标签名称获取客户的最佳方式,以及如何在没有任何标签的情况下获取客户。

【问题讨论】:

    标签: api shopify


    【解决方案1】:

    要应用查询,您需要使用搜索端点:

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

    请注意,当您的标签有空格时,您必须在查询中包含引号。如果您使用的是 Node,那么最简单的方法是

    escape("'Price Level 1'");
    

    【讨论】:

    • 感谢您的回复。它的工作完美,我得到了所有“价格级别 1”的客户。如果标签元素为空,我该如何搜索。即“标签”:“”,
    • 我认为你做不到。
    • 感谢您再回答一个问题。我可以使用 API 添加标签吗?
    • 当然可以,但你应该提出一个新问题
    猜你喜欢
    • 2018-08-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-25
    • 2017-02-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多