---
title: "collections"
description: "返回分类列表"
doc_type: graphql
doc_category: adminGraphQL
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/products-and-collections/queries/collections'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/products-and-collections/queries/collections.md'
---
# collections

返回分类列表

- **API Version:** v20270301
- **API Type:** Admin
- **API Protocol:** GraphQL
- **Operation Type:** Query

## Arguments

* `after`

  [String](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/common/scalars/string.md)

  返回指定游标之后的元素。如果指定了该参数，也必须要指定 `first` 参数。

* `before`

  [String](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/common/scalars/string.md)

  返回指定游标之前的元素。如果指定了该参数，也必须要指定 `last` 参数。

* `first`

  [Int](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/common/scalars/int.md)

  返回列表中的前 n 个元素。

* `last`

  [Int](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/common/scalars/int.md)

  返回列表中的最后 n 个元素。

* `reverse`

  [Boolean](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/common/scalars/boolean.md)

  是否反转列表的顺序。
  
  ● true：反转
  
  ● false：不反转
  
  默认值：false

* `query`

  [String](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/common/scalars/string.md)

  对查询应用一个或多个过滤器。
  
  | 参数 | 描述 |
  | --- | --- |
  | collection_type | 按分类类型查询（`MANUAL`、`SMART`），如果未指定，将返回所有类型的分类 |
  | title | 按分类标题查询。目前仅支持搜索一个标题 |
  | updated_at | 按分类更新时间查询，支持时间范围搜索. |
  
  :::tip{title="tip"}
  1·请注意，当使用**关键词**作为参数值时，需要先对其进行转义
  
  2·目前查询最多支持5个参数，后续会继续优化
  :::
  
  #### 语法参考
  
  ```js
  title:'T-shirt' AND updated_at:>'2020-10-21T23:39:20Z'
  ```
  

* `sortKey`

  [CollectionSortKeys](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/products-and-collections/enums/collection-sort-keys.md)

  按给定键对基础列表进行排序

* `savedSearchId`

  [String](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/common/scalars/string.md)

  现有的已保存搜索的ID，这个ID对应的搜索查询字符串用作查询参数。具体请参阅`SavedSearch`

## Returns

* `edges`

  [[CollectionEdge!]](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/products-and-collections/objects/collection-edge.md)

  边缘列表

* `nodes`

  [[Collection!]](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/products-and-collections/objects/collection.md)

  CollectionEdge 中包含的节点列表

* `pageInfo`

  [PageInfo!](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/common-objects/objects/page-info.md)

  帮助分页的信息

## Error Handling

关于更多通用错误码说明，参考：[状态码和错误码](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/graph-ql-admin-api/overview.md#status-and-error-codes)。

