---
title: "collection"
description: "使用 ID 检索 Collection"
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/collection'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/products-and-collections/queries/collection.md'
---
# collection

使用 ID 检索 Collection 

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

## Type Signature

`Collection`

## Arguments

* `id`

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

  根据Collection的ID进行检索

## Returns

* `banner`

  [Image](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/common-objects/objects/image.md)

  分类的横幅图片

* `descriptionHtml`

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

  描述分类的描述，包括任何 HTML 标签和格式。此内容通常会根据主题向客户显示

* `handle`

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

  标识分类的唯一字符串。如果创建分类时未指定 `handle` 值，则会根据集合的原始标题自动生成 `handle`。
  
  如果标题更改，`handle` 不会自动更改。

* `hasProduct`

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

  该分类是否包含指定的产品

* `id`

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

  全局唯一的分类ID

* `image`

  [Image](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/common-objects/objects/image.md)

  分类封面图片

* `products`

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

  分类中的产品列表

* `productsCount`

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

  分类中的产品数量

* `resourcePublicationsV2`

  [ResourcePublicationV2Connection](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/apps/objects/resource-publication-v2-connection.md)

  已发布或准备发布的资源列表，当前不支持查询分类 ResoursePublicationV2

* `ruleSet`

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

  对于智能分类，指定确定是否包含商品的规则

* `seo`

  [Seo](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/common-objects/objects/seo.md)

  分类的SEO信息

* `sortOrder`

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

  默认情况下，分类中的产品在 SHOPLINE 后台和销售渠道（例如在线商店）中的显示顺序。

* `templateSuffix`

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

  在商店中查看分类时使用的主题模板

* `title`

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

  分类的名称。它显示在 Shopline 后台中，并且通常显示在销售渠道中，例如在线商店。

* `updatedAt`

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

  上次修改分类的日期和时间（ISO 8601 格式）

## Code Example

```graphql
 {
	collection(id ) 
		 {
			# Collection fields
		}
}
```

## 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)。

