# 更新分类信息

<mark style="color:orange;">`PUT`</mark>` ``/openapi/2025-04/collections/{id}`

权限:`write_collections`

**REST参数**

| 参数名 | 说明   | 必填 | 类型        | 值可能性 | 限制 | 示例 |
| --- | ---- | -- | --------- | ---- | -- | -- |
| id  | 分类ID | 是  | \[string] |      |    | 1  |

**Header参数**

| 参数名    | 说明  | 必填 | 值可能性  | 示例    |
| ------ | --- | -- | ----- | ----- |
| X-Lang | 语言项 | 否  |       | zh-CN |

**Body参数**&#x20;

| 参数名                              | 说明       | 必填 | 类型         | 值可能性                                                                                                                                                                                                                        | 示例                                  |
| -------------------------------- | -------- | -- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- |
| name                             | 分类名称     | 是  | \[string]  |                                                                                                                                                                                                                             | collection                          |
| description                      | 分类描述     | 否  | \[string]  |                                                                                                                                                                                                                             | \<p>hello, world\</p>               |
| thumbnail                        | 缩略图ID    | 否  | \[integer] |                                                                                                                                                                                                                             | 1                                   |
| sort\_type                       | 排序类型     | 否  | \[string]  | <p>manual:手动排序</p><p>created_descending:创建时间降序</p><p>created_ascending:创建时间升序</p><p>price_descending:价格降序</p><p>price_ascending:价格升序</p><p>best_selling_descending:按销量降序</p><p>best_selling_descending_descending:按销量升序</p> | manual                              |
| seo\_title                       | SEO 标题   | 否  | \[string]  |                                                                                                                                                                                                                             | seo title                           |
| slug                             | 商品地址slug | 否  | \[string]  |                                                                                                                                                                                                                             | product-cat                         |
| product\_ids                     | 分类所含商品ID | 否  | \[array]   | \[id =>商品ID,                        locked => 锁定位置，在排序的基础上再加了一层锁定，值（0,1)]]                                                                                                                                                  |                                     |
| category\_type                   | 分类类型     | 否  | \[string]  | <p>manual_category:手动分类</p><p>auto_category:自动分类</p>                                                                                                                                                                        | auto\_category                      |
| additional                       | 额外属性     | 否  | \[string]  | <p>fetach_any:满足任意</p><p>fetach_all:满足所有</p>                                                                                                                                                                                | fetch\_all                          |
| conditions                       | 分类条件     | 否  | \[array]   |                                                                                                                                                                                                                             | 当 category\_type=auto\_category 时必填 |
| conditions\[]>>type              | 条件类型     | 是  | \[string]  | <p>title:标题</p><p>price:现价</p><p>regular_price:原价</p><p>weight:重量</p><p>tag:标签</p><p>stock:库存</p>                                                                                                                           | title                               |
| conditions\[]>>options           | 条件配置     | 是  | \[object]  |                                                                                                                                                                                                                             |                                     |
| conditions\[]>>options>>operator | 条件比较符    | 是  | \[string]  | <p>equal:相等</p><p>not_equal:不相等</p><p>more_than:大于</p><p>less_than:小于</p><p>contain:包含</p><p>not_contain:不包含</p>                                                                                                            | equal                               |
| conditions\[]>>options>>value    | 条件值      | 否  | \[string]  |                                                                                                                                                                                                                             | 100                                 |

**示例响应内容**

```json
{
    "term_taxonomy_id": 1924,
    "taxonomy": "product_cat",
    "description": "<p>product category</p>",
    "parent": 0,
    "count": 0,
    "id": 1924,
    "thumbnail": null,
    "thumbnail_url": "",
    "product_count": 0,
    "order": null,
    "seo_title": "product category",
    "seo_description": "product category description.",
    "name": "product category",
    "slug": "product-category",
    "public_url": "https://example.hotishop.com/collections/product-category",
    "base_url": "https://example.hotishop.com/collections",
    "source": null,
    "total_count": null,
    "path": "/collections/product-category",
    "sort_type": "manual",
    "category_type": "manual_category",
    "additional": "",
    "conditions": [],
    "term": {
        "term_id": 1925,
        "name": "product category",
        "slug": "product-category",
        "term_group": 0
    }
}
```
