---
title: "Collection"
description: "通过其独特属性之一获取特定的分类"
doc_type: graphql
doc_category: storefront
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/zh-hans-cn/docs/storefront-api/products/objects/collection'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/storefront-api/products/objects/collection.md'
---
# Collection

通过其独特属性之一获取特定的分类

- **API Version:** v20270301
- **API Type:** Storefront
- **API Protocol:** GraphQL
- **Operation Type:** Object

## Type Signature

`Collection`

## Fields

* `banner`

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

  banner

* `createdAt`

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

  创建时间

* `descriptionHtml`

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

  带HTML标签的分类描述

* `handle`

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

  分类handle

* `id`

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

  分类ID

* `image`

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

  分类图片

* `metafield`

  [Metafield](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/common-objects/objects/metafield.md)

  关联在分类上的元字段

* `metafields`

  [[Metafield]](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/common-objects/objects/metafield.md)

  关联在分类上的一组元字段

* `onlineStoreUrl`

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

  在当前店铺内的URL(包含域名)

* `products`

  [ProductConnection](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/products/objects/product-connection.md)

  商品集合

* `~~productsCount~~`

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

  该分类下有多少个商品 [Deprecated]

* `~~sortOrder~~`

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

  分类排序 [Deprecated]

* `templatePath`

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

  模块路径

* `title`

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

  分类标题

* `updatedAt`

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

  更新时间

## Schema Definition

```graphql
type Collection { 
	banner: Image
	createdAt: Date!
	descriptionHtml: String
	handle: String
	id: ID!
	image: Image
	metafield(identifier,HasMetafieldsIdentifierInput!): Metafield
	metafields(identifiers,[HasMetafieldsIdentifierInput!]!): [Metafield]
	onlineStoreUrl: String
	products(last,Int,before,String,after,String,reverse,Boolean,query,String,sortKey,ProductCollectionSortKeys,filters,[ProductFilterInput],first,Int): ProductConnection
	productsCount: Int
	sortOrder: String
	templatePath: String
	title: String
	updatedAt: Date 
}
```

## Field from

* [Query](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/products/queries/collection.md).collection

  通过其独特属性之一获取特定分类

* [Query](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/products/queries/proxy-node-collection.md).proxyNodeCollection

  当前接口即将下线，新增接入将无法直接使用。如需申请使用权限，请通过工单系统联系平台。

* [CollectionEdge](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/products/objects/collection-edge.md).node

  节点

* [CollectionConnection](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/products/objects/collection-connection.md).nodes

   CollectionEdge 中包含的节点列表

## Error Handling

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

