---
title: "更新主题"
description: "更新主题"
doc_type: openapi
doc_category: openapi
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/online-store/theme/update-theme'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/online-store/theme/update-theme.md'
---
# 更新主题

更新主题

- **Base URL:** `https://{handle}.myshopline.com/admin/openapi`
- **Required Scopes:** `write_content`
- **API Version:** v20270301
- **API Type:** Admin
- **API Protocol:** RESTful

## Endpoint

```http
PUT /themes/:theme_id.json
```

## Base URL

* `https://{handle}.myshopline.com/admin/openapi`

  * `{handle}`: `handle` ：店铺的唯一标识符，值为店铺域名的前缀。例如，域名为 `open001.myshopline.com` 的店铺，其 `handle` 是 `open001` 。

## Required Permissions

* `write_content`

## Request

### Path Parameters

* `theme_id`

  string (required)

  主题id

### Request Headers

* `Content-Type`

  string (required)

  字段值固定为 `application/json; charset=utf-8`。

* `Authorization`

  string (required)

  资源的访问令牌。参考 [应用授权](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/app-authorization.md?lang=zh-hans-cn) 获取访问令牌，然后将获取到的访问令牌以 Bearer 格式传入。

### Request Body

* `name`

  string

  主题的名称

* `role`

  string

  主题状态。有效枚举值包含：
  ● published：主题已发布
  ● unpublished：主题待发布
  ● development：开发状态主题

## Response

### Status Codes

* `200`

  更多状态码信息，参考 [HTTP 状态码](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/http-status-code.md?lang=zh-hans-cn)。

* `401`

  

* `429`

  

### Response Headers

* `traceId`

  请求的全局唯一标识符。用于追踪请求在系统中的流转，以便于问题发生时进行定位和调试。

### Response Body

#### 200

* `theme`

  object

  主题信息

  * `theme_type_version`

    string

    主题版本标识

  * `update_at`

    string

    更新时间 ISO 8601

  * `create_at`

    string

    创建时间 ISO 8601

  * `id`

    string

    主题的id

  * `name`

    string

    主题的名称

  * `original_theme_id`

    string

    官方主题模板id，若主题不是来源于官方主推，则返回null

  * `role`

    string

    主题状态，枚举值：published（主题已发布）； unpublished（主题待发布）；development（开发状态主题）


#### 401

* `errors`

  string

  错误描述。


#### 429

* `errors`

  string

  错误描述。


## OpenAPI Definition

```json
{
  "description": "更新主题",
  "externalDocs": {
    "description": "接口使用的权限点: `write_content` ，更多权限点使用信息，请参考:",
    "url": "ec20/3cv5d7wpfgr6a8z5/xabczf5442284vkq?lang=zh-hans-cn",
    "errorTableDescription": ""
  },
  "operationId": "GcgMTFpO",
  "parameters": [
    {
      "name": "theme_id",
      "in": "path",
      "description": "主题id",
      "required": true,
      "style": "simple",
      "schema": {
        "name": "theme_id",
        "description": "主题id",
        "type": "string",
        "example": "627d1003d4baa549bf5b83f9"
      },
      "example": "627d1003d4baa549bf5b83f9",
      "examples": {
        "更新主题": {
          "value": "6388827102b701028efac460"
        }
      }
    },
    {
      "name": "Content-Type",
      "in": "header",
      "description": "字段值固定为 `application/json; charset=utf-8`。",
      "required": true,
      "style": "string",
      "schema": {
        "name": "Content-Type",
        "type": "string",
        "example": "application/json; charset=utf-8"
      }
    },
    {
      "name": "Authorization",
      "in": "header",
      "description": "资源的访问令牌。参考 [应用授权](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/app-authorization.md?lang=zh-hans-cn) 获取访问令牌，然后将获取到的访问令牌以 Bearer 格式传入。",
      "required": true,
      "style": "string",
      "schema": {
        "name": "Authorization",
        "description": "资源的访问令牌。请参考 [应用授权](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/app-authorization.md?lang=zh-hans-cn) 获取访问令牌，然后将获取到的访问令牌以 Bearer 格式传入",
        "type": "string",
        "example": "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6MCwiYXBwS2V5IjoiNzU2ZjI1NWE2NjdlZTcwNTk1MzM0ZjVjYzk4NzU5MzBmN2E3NGZjMSIsImV4cCI6MTg3OTQ4MjA3NiwiaXNzIjoieXNvdWwiLCJzZWxsZXJJZCI6IjIwMDAyMzQ4ODAiLCJzdG9yZUlkIjoiMTY3MjM2OTcyOTYwNiIsInRpbWVzdGFtcCI6MTc4NDc4NzY3NjY2MSwidmVyc2lvbiI6IlYyIn0.3ZzbGAH4cLU1QR2VPEvMOQInUDvus-C4amkINSQIPuNVlXsFKj0sAt1c0KnUy9MWUOFV9cHlkf7J90r2y1FzpA"
      },
      "example": "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6MCwiYXBwS2V5IjoiNzU2ZjI1NWE2NjdlZTcwNTk1MzM0ZjVjYzk4NzU5MzBmN2E3NGZjMSIsImV4cCI6MTg3OTQ4MjA3NiwiaXNzIjoieXNvdWwiLCJzZWxsZXJJZCI6IjIwMDAyMzQ4ODAiLCJzdG9yZUlkIjoiMTY3MjM2OTcyOTYwNiIsInRpbWVzdGFtcCI6MTc4NDc4NzY3NjY2MSwidmVyc2lvbiI6IlYyIn0.3ZzbGAH4cLU1QR2VPEvMOQInUDvus-C4amkINSQIPuNVlXsFKj0sAt1c0KnUy9MWUOFV9cHlkf7J90r2y1FzpA"
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "name": {
              "name": "name",
              "description": "主题的名称",
              "type": "string",
              "example": "demo_theme"
            },
            "role": {
              "name": "role",
              "description": "主题状态。有效枚举值包含：\n● published：主题已发布\n● unpublished：主题待发布\n● development：开发状态主题",
              "type": "string",
              "example": "published"
            }
          },
          "example": {
            "name": "demo_theme",
            "role": "published"
          }
        },
        "examples": {
          "更新主题": {
            "value": {
              "role": "published",
              "name": "demo_theme"
            }
          }
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "description": "更多状态码信息，参考 [HTTP 状态码](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/http-status-code.md?lang=zh-hans-cn)。",
      "headers": {
        "traceId": {
          "description": "请求的全局唯一标识符。用于追踪请求在系统中的流转，以便于问题发生时进行定位和调试。"
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "theme": {
                "name": "theme",
                "description": "主题信息",
                "type": "object",
                "properties": {
                  "theme_type_version": {
                    "name": "theme_type_version",
                    "description": "主题版本标识",
                    "type": "string",
                    "example": "2.1"
                  },
                  "update_at": {
                    "name": "update_at",
                    "description": "更新时间 ISO 8601",
                    "type": "string",
                    "example": "2022-08-03T10:45:00+08:00\t\n"
                  },
                  "create_at": {
                    "name": "create_at",
                    "description": "创建时间 ISO 8601",
                    "type": "string",
                    "example": "2022-08-03T10:45:00+08:00\t\n"
                  },
                  "id": {
                    "name": "id",
                    "description": "主题的id",
                    "type": "string",
                    "example": "627d1003d4baa549bf5b83f9"
                  },
                  "name": {
                    "name": "name",
                    "description": "主题的名称",
                    "type": "string",
                    "example": "demo_theme"
                  },
                  "original_theme_id": {
                    "name": "original_theme_id",
                    "description": "官方主题模板id，若主题不是来源于官方主推，则返回null",
                    "type": "string",
                    "example": "627d1003d4baa549bf5b83f9"
                  },
                  "role": {
                    "name": "role",
                    "description": "主题状态，枚举值：published（主题已发布）； unpublished（主题待发布）；development（开发状态主题）",
                    "type": "string",
                    "example": "published"
                  }
                },
                "example": {
                  "create_at": "2022-08-03T10:45:00+08:00\t\n",
                  "id": "627d1003d4baa549bf5b83f9",
                  "name": "demo_theme",
                  "original_theme_id": "627d1003d4baa549bf5b83f9",
                  "role": "published",
                  "theme_type_version": "2.1",
                  "update_at": "2022-08-03T10:45:00+08:00\t\n"
                }
              }
            },
            "example": {
              "theme": {
                "theme_type_version": "2.1",
                "update_at": "2022-08-03T10:45:00+08:00\t\n",
                "create_at": "2022-08-03T10:45:00+08:00\t\n",
                "id": "627d1003d4baa549bf5b83f9",
                "name": "demo_theme",
                "original_theme_id": "627d1003d4baa549bf5b83f9",
                "role": "published"
              }
            }
          },
          "examples": {
            "更新主题": {
              "value": {
                "theme": {
                  "id": "6388827102b701028efac460",
                  "name": "demo_theme",
                  "original_theme_id": "62319e9585f4b048db79a50e",
                  "role": "published",
                  "update_at": "2022-12-01T20:15:53+08:00",
                  "create_at": "2022-12-01T18:31:13+08:00"
                }
              }
            }
          }
        }
      }
    },
    "401": {
      "headers": {
        "traceId": {
          "description": "请求的全局唯一标识符。用于追踪请求在系统中的流转，以便于问题发生时进行定位和调试。"
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "errors": {
                "description": "错误描述。",
                "type": "string"
              }
            },
            "required": [
              "errors"
            ]
          }
        }
      }
    },
    "429": {
      "headers": {
        "traceId": {
          "description": "请求的全局唯一标识符。用于追踪请求在系统中的流转，以便于问题发生时进行定位和调试。"
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "errors": {
                "description": "错误描述。",
                "type": "string"
              }
            },
            "required": [
              "errors"
            ]
          }
        }
      }
    }
  },
  "security": [
    {
      "oauth2": []
    }
  ],
  "method": "put",
  "path": "/themes/:theme_id.json",
  "servers": [
    {
      "url": "https://{handle}.myshopline.com/admin/openapi",
      "variables": {
        "handle": {
          "default": "openapiceshidianpu",
          "description": "`handle` ：店铺的唯一标识符，值为店铺域名的前缀。例如，域名为 `open001.myshopline.com` 的店铺，其 `handle` 是 `open001` 。"
        }
      }
    }
  ],
  "info": {
    "title": "更新主题",
    "version": "v20270301"
  },
  "authIndexes": [
    "write_content"
  ]
}
```