【问题标题】:Shopify - GraphQL - Expected Name Found StringShopify - GraphQL - 找到的预期名称字符串
【发布时间】:2019-09-22 03:44:13
【问题描述】:

我刚刚开始使用 Shopify 的 GraphQL - 看起来很有帮助,我想收集所有购买了特定变体的用户。

所以在 Postman 中,我收到了我的请求,即获取订单以及变体 ID。

但是我只想获得具有特定变体 ID 的订单。

我正在尝试这个请求,但我不断收到Parse error on \"gid://shopify/ProductVariant/123456\" (STRING) at [9, 21]",

然后当我在explorer on the Shopify page 上尝试查询时,它显示Expected Name Found String

任何想法正确的应该是什么?:

{
  orders(first: 5) {
    edges {
      node {
        lineItems(first: 5) {
          edges {
            node {
              variant {
                id: "gid://shopify/ProductVariant/123456"
              }
            }
          }
        }
      }
    }
  }
}

【问题讨论】:

  • 更新:我想出了办法,我需要orders(query: "lineItems.edges.node.variant.id:123456", first: 10) {
  • 但是我不知道如何使用AND&& 进行多个查询似乎不起作用
  • 实际上上面的方法并不完全有效——它没有准确返回123456,结果还包括123872之类的东西

标签: graphql shopify


【解决方案1】:

尝试检查 shopify GrapQl 使用年龄文档。从上面发布的代码中我可以看到,它可能正在请求数据类型 Name 并找到了 String 类型的数据。而且你的论点应该在 inside() 而不是花括号{ }。

类似的东西 变体(id:“gid://shopify/ProductVariant/123456”) { ...请求参数 }

【讨论】:

    猜你喜欢
    • 2020-10-03
    • 2022-12-05
    • 2021-02-18
    • 2020-01-01
    • 2018-06-28
    • 2013-03-27
    • 2021-07-28
    • 1970-01-01
    • 2018-04-02
    相关资源
    最近更新 更多