VI | EN
Nhắn Messenger
Dành cho developer

Tải lên ảnh cho bình luận — API TikTok Business

Upload a comment image · gọi qua Quantri360 bằng một API key cho chính tài khoản / tài sản bạn đã kết nối và ủy quyền — 360 lo việc ký request và làm mới phiên đăng nhập bạn đã cấp.

Upload a comment image

POST/business/comment/image/upload/Gọi qua 360: POST https://partner.quantri360.com/v1/tiktok_business/business/comment/image/upload/
Endpoint ghi — thay đổi dữ liệu trên TikTok Business. Key phải được tạo với tick "Cho phép gọi API ghi", nếu không sẽ nhận 403 write_not_allowed. Mỗi lần gọi được ghi nhật ký.
Mô tả API

Tải lên ảnh cho bình luận mới hoặc phản hồi bình luận và nhận image_uri để đưa vào yêu cầu tạo bình luận hoặc tạo phản hồi.

Request

Địa chỉ

POST https://partner.quantri360.com/v1/tiktok_business/business/comment/image/upload/

Xác thực & gian hàng

TênVị tríKiểuMẫuMô tả
AuthorizationheaderheaderBearer q360_live_ab12cd34_…Khóa API của brand (tạo ở mục API key). Bắt buộc với mọi request. Brand suy từ key — không truyền mã brand.
platform_shop_idquerystring7000000000000000001Tài sản TikTok Business đã kết nối — "Mã tài sản" ở trang Nền tảng hoặc GET /v1/platforms (tài khoản quảng cáo cho Marketing API, tài khoản TikTok cho Organic / Messaging). Có thể bỏ khi chỉ kết nối một tài sản.

Tham số request

TênVị tríKiểuBắt buộcMẫuMô tả
image_filebodyfileCóThe image file which will be used to generate a new comment or to add reply to an existing comment thread. Maximum size: 5 MB. Maximum resolution: 1080 x 1920 pixels or 1920 x 1080 pixels. Minimum resolution: 360 x 360 pixels. File types supported: JPG, JPEG, WebP, or PNG.

Ví dụ request

curl -s -X POST "https://partner.quantri360.com/v1/tiktok_business/business/comment/image/upload/" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"image_file":""}'
Python
import requests

KEY = "q360_live_..."  # khóa API của brand
r = requests.post(
    "https://partner.quantri360.com/v1/tiktok_business/business/comment/image/upload/",
    params={},
    json={
        "image_file": ""
    },
    headers={"Authorization": f"Bearer {KEY}"},
    timeout=60,
)
print(r.status_code)
print(r.json())
Node.js
const KEY = 'q360_live_...'; // khóa API của brand
const url = new URL('https://partner.quantri360.com/v1/tiktok_business/business/comment/image/upload/');
for (const [k, v] of Object.entries({})) url.searchParams.set(k, typeof v === 'object' ? JSON.stringify(v) : String(v));
const r = await fetch(url, {
  method: 'POST',
  headers: { Authorization: `Bearer ${KEY}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({"image_file":""}),
});
console.log(r.status, await r.json());
PHP
<?php
$key = 'q360_live_...'; // khóa API của brand
$url = 'https://partner.quantri360.com/v1/tiktok_business/business/comment/image/upload/' . '?' . http_build_query([]);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer ' . $key, 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"image_file":""}');
$res = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $status, "\n", $res;

Response

Tham số phản hồi (nguyên của TikTok Business)

TênKiểuMẫuMô tả
request_idstringUnique identifier for the API request. Note: Please record this field for all API requests. Important for issue reports and troubleshooting.
codeintegerResponse code. For the complete list of response codes and descriptions, see Appendix - Return Codes.
messagestringResponse message. For details, see Appendix - Return Information.
dataobjectReturned data.
image_uristringURI for the uploaded image. Returned when an accepted image type is uploaded.
widthintegerWidth of the `image_file`. Example: 720.
heightintegerHeight of the `image_file`. Example: 900.

Mẫu phản hồi

HTTPS/1.1 200 OK
{
    "code": 0,
    "message": "OK",
    "request_id": "{{request_id}}",
    "data": {
        "height": 402,
        "image_uri": "{{image_uri}}",
        "width": 428
    }
}

Bắt đầu dùng

  1. Đăng ký tài khoản Partner
  2. Mở loại dữ liệu thuộc nhóm Tài khoản TikTok (Organic API) ở trang nền tảng
  3. Tạo API key (tick kênh TikTok Business)
  4. Gọi theo ví dụ ở trên