---
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/page/update-a-custom-page'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/online-store/page/update-a-custom-page.md'
---
# 更新自定义页面

为店铺更新指定自定义页面。

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

## Endpoint

```http
PUT /store/page/customize.json
```

## Base URL

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

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

## Required Permissions

* `write_page`

## Request

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

* `req`

  object

  请求参数。
  
    - 为空或传 `null` 的参数保持原有数据不变。
    - 传空值（`""`）的参数会被清空数据。

  * `handle`

    string

    自定义页面的语义化标识符。

  * `published_at`

    string

    自定义页面的发布时间，不得早于当前时间。当 `published_status` 为 `false` 时填写该字段。格式：`yyyy-MM-dd HH:mm:ss.SSS`。

  * `published_status`

    boolean

    是否发布自定义页面。
    - `true`：立即发布。
    - `false`：暂不发布或定时发布，定时发布需填写 `published_at` 字段。
      
    默认取值为 `true`。

  * `template_name`

    string

    自定义页面使用的模版名称。

  * `template_type`

    integer

    自定义页面使用的模版类型。模版类型包含：
    - `0`：默认主题模板。
    - `1`：公共模版，所有主题均可使用。
    - `2`：通过应用定义的主题模版，仅对当前主题生效 。

  * `url`

    string

    自定义页面 URL 的相对路径。详情参考 [URL 结构设置](https://help.shopline.com/hc/zh-cn/articles/33749590631961-URL%E7%BB%93%E6%9E%84%E8%AE%BE%E7%BD%AE) 了解自定义 URL 相关内容。
    
    最大长度限制：512

  * `body_html`

    string

    自定义页的正文内容，包含 HTML 标签.
    
    文件大小不得超过`16MB`。

  * `page_id`

    string

    自定义页面的唯一标识 ID。

  * `title`

    string

    自定义页面的标题。
    
    最大长度限制：255

  * `updater`

    string

    自定义页面的更新人 ID 或名称。

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

* `data`

  object

  响应信息。

  * `handle`

    string

    自定义页面的语义化标识符。

  * `id`

    string

    自定义页面的唯一标识 ID。

  * `published_at`

    string

    自定义页面的发布时间。格式：`yyyy-MM-dd HH:mm:ss.SSS`。

  * `published_status`

    boolean

    是否发布自定义页面。
    - `true`：已发布。
    - `false`：未发布。

  * `template_name`

    string

    自定义页面使用的模版名称。

  * `title`

    string

    自定义页面的标题。

  * `author`

    string

    自定义页面的创建者 ID 或名称。

  * `body_html`

    string

    自定义页的正文内容，包含 HTML 标签。

* `msg`

  string

  响应信息，包含成功或失败原因。


#### 401

* `errors`

  string

  错误描述。


#### 429

* `errors`

  string

  错误描述。


## OpenAPI Definition

```json
{
  "tags": [
    "更新自定义页面"
  ],
  "description": "为店铺更新指定自定义页面。",
  "externalDocs": {
    "description": "接口使用的权限点: `write_page` ，更多权限点使用信息，请参考:",
    "url": "ec20/3cv5d7wpfgr6a8z5/xabczf5442284vkq?lang=zh-hans-cn",
    "errorTableDescription": "| Error Code | HTTP Status Code | Error Description |\n|------------|------------------|-------------------|\n| PATH_EXISTED | 422 | The path already exists. |\n| REDIRECT_PATH_RISK_CONTROLLED | 422 | The redirect path is risk controlled. |\n| PATH_FAILED_TO_REDIRECT | 422 | The path failed to create a redirect. |\n| PATH_INVALID | 200 | The path is invalid. |\n| SUCCESS | 200 | request success |\n| DATA_IS_NOT_EXIST | 406 | The requested data does not exist. |\n| INVALID_ARGUMENT | 422 | T-OFC-A-INVALID_ARGUMENT |\n"
  },
  "operationId": "OXPSKTaX",
  "parameters": [
    {
      "name": "Content-Type",
      "in": "header",
      "description": "字段值固定为 `application/json; charset=utf-8`。",
      "required": true,
      "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": {
          "name": "body",
          "description": "body位置参数",
          "type": "object",
          "properties": {
            "req": {
              "name": "req",
              "description": "请求参数。\n\n  - 为空或传 `null` 的参数保持原有数据不变。\n  - 传空值（`\"\"`）的参数会被清空数据。",
              "type": "object",
              "properties": {
                "handle": {
                  "name": "handle",
                  "description": "自定义页面的语义化标识符。",
                  "type": "string",
                  "example": "contact-us"
                },
                "published_at": {
                  "name": "published_at",
                  "description": "自定义页面的发布时间，不得早于当前时间。当 `published_status` 为 `false` 时填写该字段。格式：`yyyy-MM-dd HH:mm:ss.SSS`。",
                  "type": "string",
                  "example": "2023-09-11 16:49:35.120"
                },
                "published_status": {
                  "name": "published_status",
                  "description": "是否发布自定义页面。\n- `true`：立即发布。\n- `false`：暂不发布或定时发布，定时发布需填写 `published_at` 字段。\n  \n默认取值为 `true`。",
                  "type": "boolean"
                },
                "template_name": {
                  "name": "template_name",
                  "description": "自定义页面使用的模版名称。",
                  "type": "string",
                  "example": "templates/page.contact.json"
                },
                "template_type": {
                  "name": "template_type",
                  "description": "自定义页面使用的模版类型。模版类型包含：\n- `0`：默认主题模板。\n- `1`：公共模版，所有主题均可使用。\n- `2`：通过应用定义的主题模版，仅对当前主题生效 。",
                  "type": "integer"
                },
                "url": {
                  "name": "url",
                  "description": "自定义页面 URL 的相对路径。详情参考 [URL 结构设置](https://help.shopline.com/hc/zh-cn/articles/33749590631961-URL%E7%BB%93%E6%9E%84%E8%AE%BE%E7%BD%AE) 了解自定义 URL 相关内容。\n\n最大长度限制：512",
                  "type": "string",
                  "example": "/customurl/contact_us"
                },
                "body_html": {
                  "name": "body_html",
                  "description": "自定义页的正文内容，包含 HTML 标签.\n\n文件大小不得超过`16MB`。",
                  "type": "string",
                  "example": "<p>We love to hear from you.</p>"
                },
                "page_id": {
                  "name": "page_id",
                  "description": "自定义页面的唯一标识 ID。",
                  "type": "string",
                  "example": "6743314731912662424"
                },
                "title": {
                  "name": "title",
                  "description": "自定义页面的标题。\n\n最大长度限制：255",
                  "type": "string",
                  "example": "Contact us"
                },
                "updater": {
                  "name": "updater",
                  "description": "自定义页面的更新人 ID 或名称。",
                  "type": "string",
                  "example": "Alvin"
                }
              },
              "required": [
                "updater",
                "page_id"
              ],
              "example": {
                "body_html": "<p>We love to hear from you.</p>",
                "handle": "contact-us",
                "page_id": "6743314731912662424",
                "published_at": "2023-09-11 16:49:35.120",
                "published_status": null,
                "template_name": "templates/page.contact.json",
                "title": "Contact us",
                "template_type": null,
                "updater": "Alvin",
                "url": "/customurl/contact_us"
              }
            }
          },
          "required": [
            "req"
          ],
          "example": {
            "req": {
              "url": "/customurl/contact_us",
              "handle": "contact-us",
              "page_id": "6743314731912662424",
              "published_at": "2023-09-11 16:49:35.120",
              "template_name": "templates/page.contact.json",
              "updater": "Alvin",
              "body_html": "<p>We love to hear from you.</p>",
              "published_status": null,
              "template_type": null,
              "title": "Contact us"
            }
          }
        },
        "examples": {
          "更新自定义页面": {
            "description": "更新自定义页面",
            "value": {
              "req": {
                "author": "shopline",
                "handle": "my-custom-page-5",
                "published_at": "2023-09-07 17:17:02.868",
                "template_type": 2,
                "title": "MY CUSTOM PAGE 5",
                "updater": "3400001642",
                "body_html": "MY CUSTOM PAGE CONTENT",
                "page_id": "6933242399154775415",
                "published_status": "true",
                "template_name": "templates/page.json"
              }
            }
          }
        }
      }
    },
    "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": {
            "name": "body",
            "type": "object",
            "properties": {
              "data": {
                "name": "data",
                "description": "响应信息。",
                "type": "object",
                "properties": {
                  "handle": {
                    "name": "handle",
                    "description": "自定义页面的语义化标识符。",
                    "type": "string",
                    "example": "contact-us"
                  },
                  "id": {
                    "name": "id",
                    "description": "自定义页面的唯一标识 ID。",
                    "type": "string",
                    "example": "6743314731912662424"
                  },
                  "published_at": {
                    "name": "published_at",
                    "description": "自定义页面的发布时间。格式：`yyyy-MM-dd HH:mm:ss.SSS`。",
                    "type": "string",
                    "example": "2023-09-11 16:49:35.120"
                  },
                  "published_status": {
                    "name": "published_status",
                    "description": "是否发布自定义页面。\n- `true`：已发布。\n- `false`：未发布。",
                    "type": "boolean"
                  },
                  "template_name": {
                    "name": "template_name",
                    "description": "自定义页面使用的模版名称。",
                    "type": "string",
                    "example": "templates/page.contact.json"
                  },
                  "title": {
                    "name": "title",
                    "description": "自定义页面的标题。",
                    "type": "string",
                    "example": "Contact us"
                  },
                  "author": {
                    "name": "author",
                    "description": "自定义页面的创建者 ID 或名称。",
                    "type": "string",
                    "example": "Alvin"
                  },
                  "body_html": {
                    "name": "body_html",
                    "description": "自定义页的正文内容，包含 HTML 标签。",
                    "type": "string",
                    "example": "<p>We love to hear from you.</p>"
                  }
                },
                "example": {
                  "id": "6743314731912662424",
                  "published_at": "2023-09-11 16:49:35.120",
                  "published_status": null,
                  "template_name": "templates/page.contact.json",
                  "title": "Contact us",
                  "author": "Alvin",
                  "body_html": "<p>We love to hear from you.</p>",
                  "handle": "contact-us"
                }
              },
              "msg": {
                "name": "msg",
                "description": "响应信息，包含成功或失败原因。",
                "type": "string"
              }
            },
            "example": {
              "data": {
                "published_at": "2023-09-11 16:49:35.120",
                "published_status": null,
                "template_name": "templates/page.contact.json",
                "title": "Contact us",
                "author": "Alvin",
                "body_html": "<p>We love to hear from you.</p>",
                "handle": "contact-us",
                "id": "6743314731912662424"
              },
              "msg": null
            }
          },
          "examples": {
            "更新自定义页面": {
              "description": "更新自定义页面",
              "value": {
                "data": {
                  "author": "shopline",
                  "body_html": "MY CUSTOM PAGE CONTENT",
                  "handle": "my-custom-page-5",
                  "id": "6933242399154775415",
                  "template_name": "templates/page.json",
                  "title": "MY CUSTOM PAGE 5"
                },
                "msg": "success"
              }
            }
          }
        }
      }
    },
    "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": "/store/page/customize.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_page"
  ]
}
```