代码之家  ›  专栏  ›  技术社区  ›  deanWombourne

Shopify Storefront API-productByHandle不返回前一个API调用刚刚返回的产品

  •  0
  • deanWombourne  · 技术社区  · 4 年前

    我使用iossdk调用Storefront API来获取产品列表。

    {products(first:20,query:"product_type:Mug"){edges{node{title,handle,images(first:1){edges{node{transformedSrc(maxWidth:400,maxHeight:400),originalSrc,altText,id}}}}}}}
    

    返回预期的产品列表。

    然后我打电话从列表中获取有关特定产品的更多信息:

    {productByHandle(handle:"handle-from-previous-query"){id,description,images{edges{node{transformedSrc(maxWidth:640,maxHeight:640)}}}}}
    

    但是,它不返回任何产品(它返回的是: <QueryRoot: ["productByHandle": <null>]> ).

    我已经检查过是否传递了第一个api响应的值,我是。我还检查了手柄是否正确,通过在网上查看它的工作。

    我不明白这一点,因为产品肯定存在,而且是可见的,因为它刚刚从第一个api调用返回!

    有什么建议吗?

    0 回复  |  直到 4 年前
        1
  •  3
  •   Vladimir    4 年前

    你错过了比赛 first

    {
      productByHandle(handle: "handle-from-previous-query") {
        id
        description
        images(first: 100) {
          edges {
            node {
              transformedSrc(maxWidth: 640, maxHeight: 640)
            }
          }
        }
      }
    }