【发布时间】:2021-02-13 13:28:25
【问题描述】:
我是 graphQL 的新手,我必须检索所有产品。我一直在环顾四周,看教程和阅读,人们似乎返回了他们想要的所有特定类型的数据,但我不能。例如,它会抛出一个错误,说您必须提供第一个或最后一个,但我想要所有这些,否则它会说 totalCount 或 count 不存在。
{
products {
id
title
price
}
}
// or get total count of products
{
products {
totalCount
}
}
我基本上是在尝试做类似的事情。我知道我可能不会得到任何帮助,因为没有人可以访问我的 shopify admin api,甚至可能是一个示例或我能看到的任何内容。这是来自我对产品的选项的 graphQL 查询根。 产品列表。
ProductConnection!
first: Int
Returns up to the first n elements from the list.
after: String
Returns the elements that come after the specified cursor.
last: Int
Returns up to the last n elements from the list.
before: String
Returns the elements that come before the specified cursor.
reverse: Boolean = false
Reverse the order of the underlying list.
sortKey: ProductSortKeys = ID
Sort the underlying list by the given key.
query: String
Supported filter parameters:
barcode
created_at
delivery_profile_id
error_feedback
gift_card
inventory_total
is_price_reduced
out_of_stock_somewhere
price
product_type
publishable_status
published_status
sku
status
tag
title
updated_at
vendor
See the detailed search syntax for more information about using filters.
savedSearchId: ID
ID of an existing saved search. The search’s query string is used as the query argument.
【问题讨论】: