我正在使用iOS SDK来调用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调用返回的!
有什么建议吗?
您错过了图像的first
运算符:
{productByHandle(handle:"handle-from-previous-query"){id,description,images(first:100){edges{node{transformedSrc(maxWidth:640,maxHeight:640)}}}}}