collections
query
接口访问需要令牌,具体如何获取令牌参考:身份认证。
查询店铺分类列表。
Arguments
返回指定游标之后的元素。如果指定了该参数,也必须要指定
first 参数。返回指定游标之前的元素。如果指定了该参数,也必须要指定
last 参数。返回列表中的前 n 个元素。
返回列表中的最后 n 个元素。
是否反转列表的顺序。
● true:反转
● false:不反转
默认值:false
按特定维度对列表排序。
对查询应用一个或多个过滤器。
注意
1.如果参数值包含关键字,必须先对关键字进行转义。
2.查询最多支持 5 个过滤器。
| 过滤器字段 | 描述 |
|---|---|
| collection_type | 按分类类型查询。有效枚举值包含 manual(手动分类)和 smart(智能分类)。若未指定分类类型,将返回所有类型的分类。 |
| title | 按分类标题查询。目前仅支持搜索一个标题。 |
| updated_at | 按分类更新时间查询。格式:ISO 8601。支持时间范围搜索。 |
语法参考
title:'T-shirt' AND updated_at:>'2020-10-21T23:39:20Z'
指定查询的分类 ID,多个 ID 用英文逗号分隔。
Return
分类信息
CollectionEdge 中包含的节点列表
分页信息
分类发布在该渠道的数量
错误码
关于更多通用错误码说明,参考:状态码和错误码。
Example
根据指定标题查询分类
Code
query collections @inContext(saleChannel: "web",country:CN,language:EN){
collections(first: 2, query: "title:\"collection\" OR title:\"Custom\"" ) {
edges {
node {
id
title
products(first: 2) {
edges {
node {
id
title
}
}
}
}
}
}
}
Response
{
"data": {
"collections": {
"edges": [
{
"node": {
"id": "gid://shopline/Collection/12261186277836500577262340",
"products": {
"edges": []
},
"title": "Third Custom Collection"
}
},
{
"node": {
"id": "gid://shopline/Collection/12273187462690727542132340",
"products": {
"edges": [
{
"node": {
"id": "gid://shopline/Product/16073187380346473690812340",
"title": "A product title"
}
}
]
},
"title": "Third Custom Collection"
}
}
]
}
},
"extensions": {
"cost": {
"actualQueryCost": 31,
"requestedQueryCost": 31,
"throttleStatus": {
"currentlyAvailable": 4969,
"maximumAvailable": 5000,
"restoreRate": 5000
}
}
}
}
这篇文章对你有帮助吗?