← 返回目录
📁 API Reference › Accounts › Comments

上传评论图片

此接口可用于为新评论或回复现有评论上传图片,返回的 image_uri 可在调用 /business/comment/create/ 或 /business/comment/reply/create/ 接口时一并传入。

请求

地址 https://business-api.tiktok.com/open_api/v1.3/business/comment/image/upload/

方法 POST

Header

|字段{30%}|类型{15%}|描述{55%}|
|---|---|---|
|Access-Token {必填}|string|授权访问令牌。|
|Content-Type {必填}|string|请求信息类型。<br><br>允许格式:`multipart/form-data`。|

参数

|字段{30%}|类型{15%}|描述{55%}|
|---|---|---|
|image_file {必填}|file|用于生成新评论或回复现有评论的图片文件。<br><br>大小上限:5 MB。<br><br>最高分辨率:1080 x 1920 px 或 1920 x 1080 px。<br><br>最低分辨率:360 x 360 px。<br><br>支持文件类型:JPG、JPEG、WebP 或 PNG。|

示例

(code curl http)
curl --location --request POST 'https://business-api.tiktok.com/open_api/v1.3/business/comment/image/upload/' \
--header 'Access-Token: {{Access-Token}}' \
--form 'business_id="{{business_id}}"' \
--form 'image_file=@"{{image_file}}"'
(/code)

返回

|字段{30%}|类型{15%}|描述{55%}|
|---|---|---|
|request_id|string|API 请求的唯一识别 ID。<br><br><p><span style="color:darkred"><b>注意</b></span>:请记录所有 API 请求的唯一识别 ID。此字段对于问题报告和排查非常重要。</p>|
|code|integer|返回码。完整返回码列表及描述参见[附录 - 返回码](1737172488964097.html)。|
|message|string|返回信息。更多信息参见[附录 - 返回信息](1737172488964097.html)。|
|data|object|返回数据。|
#|image_uri|string|已上传图片的 URI。<br><br>当上传的图片为可接受类型时返回。|
#|width|integer|`image_file` 的宽度。<br><br><strong>示例</strong>:720。|
#|height|integer|`image_file` 的高度。<br><br><strong>示例</strong>:900。|

示例

(code Success-Response http)
HTTPS/1.1 200 OK
{
    "code": 0,
    "message": "OK",
    "request_id": "{{request_id}}",
    "data": {
        "height": 402,
        "image_uri": "{{image_uri}}",
        "width": 428
    }
}
(/code)

内容来源:TikTok API for Business 官方文档 · 本地归档

在接这个接口时卡住了?
Stuck wiring this API into production? We build ad-delivery tooling on these platforms — campaign automation, reporting pipelines, error-handling and migration between API versions.
联系我们 · Talk to us 每日平台更新简报 →