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ên | Vị trí | Kiểu | Mẫu | Mô tả |
|---|---|---|---|---|
| Authorization | header | header | Bearer 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_id | query | string | 7000000000000000001 | Tà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ên | Vị trí | Kiểu | Bắt buộc | Mẫu | Mô tả |
|---|---|---|---|---|---|
| image_file | body | file | Có | 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ên | Kiểu | Mẫu | Mô tả |
|---|---|---|---|
| request_id | string | Unique identifier for the API request. Note: Please record this field for all API requests. Important for issue reports and troubleshooting. | |
| code | integer | Response code. For the complete list of response codes and descriptions, see Appendix - Return Codes. | |
| message | string | Response message. For details, see Appendix - Return Information. | |
| data | object | Returned data. | |
| image_uri | string | URI for the uploaded image. Returned when an accepted image type is uploaded. | |
| width | integer | Width of the `image_file`. Example: 720. | |
| height | integer | Height 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
- Đăng ký tài khoản Partner
- Mở loại dữ liệu thuộc nhóm Tài khoản TikTok (Organic API) ở trang nền tảng
- Tạo API key (tick kênh TikTok Business)
- Gọi theo ví dụ ở trên