---
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/comments/create-a-comment'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/online-store/comments/create-a-comment.md'
---
# 创建评论

创建评论

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

## Endpoint

```http
POST /store/comments.json
```

## Base URL

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

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

## Required Permissions

* `write_content`

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

* `body_html`

  string

  含有html标记的body内容

* `email`

  string

  评论作者的邮件地址

* `ip`

  string

  发表评论的ip

* `author`

  string

  评论的作者

* `blog_id`

  string

  评论所属博客id

* `body`

  string

  评论内容

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

* `comment`

  object

  评论信息

  * `user_agent`

    string

    用户代理

  * `author`

    string

    评论的作者

  * `blog_id`

    string

    评论所属博客id

  * `body_html`

    string

    含有html标记的body内容

  * `id`

    string

    评论id

  * `body`

    string

    评论内容

  * `status`

    string

    评论状态，枚举值：unapproved（默认状态，评论等待批准，C端不展示此状态评论）； published：（已发布状态，并且对C端用户可见）； spam：（垃圾评论，C端用户不可见）； removed：（评论标记为已删除状态，C端用户不可见）

  * `blog_collection_id`

    string

    评论所属的文章归属的博客集合id

  * `email`

    string

    评论作者的邮件地址

  * `published_at`

    string

    发布评论的时间 ISO 8601

  * `create_at`

    string

    评论的创建时间 ISO 8601

  * `ip`

    string

    发表评论的ip

  * `updated_at`

    string

    更新时间 ISO 8601


#### 401

* `errors`

  string

  错误描述。


#### 429

* `errors`

  string

  错误描述。


## OpenAPI Definition

```json
{
  "description": "创建评论",
  "externalDocs": {
    "description": "接口使用的权限点: `write_content` ，更多权限点使用信息，请参考:",
    "url": "ec20/3cv5d7wpfgr6a8z5/xabczf5442284vkq?lang=zh-hans-cn",
    "errorTableDescription": ""
  },
  "operationId": "OYTJBXAP",
  "parameters": [
    {
      "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": {
            "body_html": {
              "name": "body_html",
              "description": "含有html标记的body内容",
              "type": "string",
              "example": "<p>demo-content</p>"
            },
            "email": {
              "name": "email",
              "description": "评论作者的邮件地址",
              "type": "string",
              "example": "demo@qq.com"
            },
            "ip": {
              "name": "ip",
              "description": "发表评论的ip",
              "type": "string",
              "example": "172.28.173.136"
            },
            "author": {
              "name": "author",
              "description": "评论的作者",
              "type": "string",
              "example": "demo-author"
            },
            "blog_id": {
              "name": "blog_id",
              "description": "评论所属博客id",
              "type": "string",
              "example": "63a2afa527797d5cedcecb52"
            },
            "body": {
              "name": "body",
              "description": "评论内容",
              "type": "string",
              "example": "demo-content"
            }
          },
          "required": [
            "author",
            "blog_id",
            "body",
            "email",
            "ip"
          ],
          "example": {
            "blog_id": "63a2afa527797d5cedcecb52",
            "body": "demo-content",
            "body_html": "<p>demo-content</p>",
            "email": "demo@qq.com",
            "ip": "172.28.173.136",
            "author": "demo-author"
          }
        },
        "examples": {
          "创建评论": {
            "value": {
              "body_html": "<p>demo-content</p>",
              "email": "demo@qq.com",
              "ip": "172.28.173.136",
              "author": "demo-author",
              "blog_id": "63aa94116b7b014b289c0752",
              "body": "demo-content"
            }
          }
        }
      }
    },
    "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": {
              "comment": {
                "name": "comment",
                "description": "评论信息",
                "type": "object",
                "properties": {
                  "user_agent": {
                    "name": "user_agent",
                    "description": "用户代理",
                    "type": "string",
                    "example": ""
                  },
                  "author": {
                    "name": "author",
                    "description": "评论的作者",
                    "type": "string",
                    "example": "demo-author"
                  },
                  "blog_id": {
                    "name": "blog_id",
                    "description": "评论所属博客id",
                    "type": "string",
                    "example": "63a2afa527797d5cedcecb52"
                  },
                  "body_html": {
                    "name": "body_html",
                    "description": "含有html标记的body内容",
                    "type": "string",
                    "example": "<p>demo-content</p>"
                  },
                  "id": {
                    "name": "id",
                    "description": "评论id",
                    "type": "string",
                    "example": "63aaa20f6b7b014b289c0765"
                  },
                  "body": {
                    "name": "body",
                    "description": "评论内容",
                    "type": "string",
                    "example": "demo-content"
                  },
                  "status": {
                    "name": "status",
                    "description": "评论状态，枚举值：unapproved（默认状态，评论等待批准，C端不展示此状态评论）； published：（已发布状态，并且对C端用户可见）； spam：（垃圾评论，C端用户不可见）； removed：（评论标记为已删除状态，C端用户不可见）",
                    "type": "string",
                    "example": "unapproved"
                  },
                  "blog_collection_id": {
                    "name": "blog_collection_id",
                    "description": "评论所属的文章归属的博客集合id",
                    "type": "string",
                    "example": "639bfda0ee877c4a9bd600b6"
                  },
                  "email": {
                    "name": "email",
                    "description": "评论作者的邮件地址",
                    "type": "string",
                    "example": "demo@qq.com"
                  },
                  "published_at": {
                    "name": "published_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"
                  },
                  "ip": {
                    "name": "ip",
                    "description": "发表评论的ip",
                    "type": "string",
                    "example": "172.28.173.136"
                  },
                  "updated_at": {
                    "name": "updated_at",
                    "description": "更新时间 ISO 8601",
                    "type": "string",
                    "example": "2022-08-03T10:45:00+08:00\t\n"
                  }
                },
                "example": {
                  "email": "demo@qq.com",
                  "id": "63aaa20f6b7b014b289c0765",
                  "ip": "172.28.173.136",
                  "blog_collection_id": "639bfda0ee877c4a9bd600b6",
                  "body": "demo-content",
                  "author": "demo-author",
                  "blog_id": "63a2afa527797d5cedcecb52",
                  "published_at": "2022-08-03T10:45:00+08:00\t\n",
                  "updated_at": "2022-08-03T10:45:00+08:00\t\n",
                  "user_agent": "",
                  "status": "unapproved",
                  "body_html": "<p>demo-content</p>",
                  "create_at": "2022-08-03T10:45:00+08:00\t\n"
                }
              }
            },
            "example": {
              "comment": {
                "status": "unapproved",
                "body_html": "<p>demo-content</p>",
                "blog_id": "63a2afa527797d5cedcecb52",
                "updated_at": "2022-08-03T10:45:00+08:00\t\n",
                "blog_collection_id": "639bfda0ee877c4a9bd600b6",
                "ip": "172.28.173.136",
                "author": "demo-author",
                "user_agent": "",
                "body": "demo-content",
                "create_at": "2022-08-03T10:45:00+08:00\t\n",
                "id": "63aaa20f6b7b014b289c0765",
                "email": "demo@qq.com",
                "published_at": "2022-08-03T10:45:00+08:00\t\n"
              }
            }
          },
          "examples": {
            "创建评论": {
              "value": {
                "comment": {
                  "body_html": "<p>demo-content</p>",
                  "create_at": "2022-12-27T21:30:24+08:00",
                  "email": "demo@qq.com",
                  "status": "published",
                  "updated_at": "2022-12-27T21:30:24+08:00",
                  "body": "demo-content",
                  "ip": "172.28.173.136",
                  "published_at": "2022-12-27T21:30:24+08:00",
                  "blog_id": "63aa94116b7b014b289c0752",
                  "blog_collection_id": "63a9a344609552261f00f23e",
                  "author": "demo-author",
                  "id": "63aaf3707f8ccd348128216d"
                }
              }
            }
          }
        }
      }
    },
    "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": "post",
  "path": "/store/comments.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"
  ]
}
```