---
title: "CollectionInput"
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/inputs/collection-input'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/products-and-collections/inputs/collection-input.md'
---
# CollectionInput

创建分类所需的输入字段

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

## Type Signature

`CollectionInput`

## Input Fields

* `title`

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

  分类标题，创建分类时必须传入

* `templateSuffix`

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

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

* `sortOrder`

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

  分类中商品的排序

* `descriptionHtml`

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

  分类的描述

* `image`

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

  与分类相关的封面图

* `ruleSet`

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

  用于将产品分配到分类的规则

* `handle`

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

  分类唯一的友好字符串，根据分类标题自动生成

* `id`

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

  全局唯一的分类ID，只适用于更新分类传入

* `redirectNewHandle`

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

  表示提供新的 handle 之后是否需要重定向。如果为 `true` ，则旧的 handle 将自动重定向到新的 handle
  
  只适用于更新分类
  
  默认：`false`

* `banner`

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

  与分类相关的横幅图

* `products`

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

  分类中初始的商品列表。仅对 `collectionCreate` 有效，并且没有智能分类规则

## Schema Definition

```graphql
input CollectionInput { 
	title: String!
	templateSuffix: String
	sortOrder: CollectionSortOrder
	descriptionHtml: String
	image: ImageInput
	ruleSet: CollectionRuleSetInput
	handle: String
	id: ID
	redirectNewHandle: Boolean
	banner: ImageInput
	products: [ID] 
}
```

## Argument from

* [Mutation](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/products-and-collections/mutations/collection-create.md).collectionCreate

  创建一个新分类

* [Mutation](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/products-and-collections/mutations/collection-update.md).collectionUpdate

  更新分类

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

