Xem trước bài đăng trên từng nền tảng
curl --request GET \
--url https://app.getkavio.app/api/posts/{post}/preview \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.getkavio.app/api/posts/{post}/preview"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.getkavio.app/api/posts/{post}/preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.getkavio.app/api/posts/{post}/preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.getkavio.app/api/posts/{post}/preview"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://app.getkavio.app/api/posts/{post}/preview")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.getkavio.app/api/posts/{post}/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyBài đăng
Xem trước bài đăng trên từng nền tảng
Xem trước cách bài đăng hiển thị trên từng nền tảng đang bật, sau khi xử lý HTML và đối chiếu độ dài với giới hạn của nền tảng.
GET
/
posts
/
{post}
/
preview
Xem trước bài đăng trên từng nền tảng
curl --request GET \
--url https://app.getkavio.app/api/posts/{post}/preview \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.getkavio.app/api/posts/{post}/preview"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.getkavio.app/api/posts/{post}/preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.getkavio.app/api/posts/{post}/preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.getkavio.app/api/posts/{post}/preview"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://app.getkavio.app/api/posts/{post}/preview")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.getkavio.app/api/posts/{post}/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyTham số đường dẫn
string
bắt buộc
UUID của bài đăng.
Cách hoạt động
- Bài đăng phải thuộc không gian làm việc hiện tại của bên gọi; nếu không, API trả về
404. - Trả về nội dung gốc, phiên bản đã làm sạch cho từng nền tảng và số liệu độ dài.
original_contentlà văn bản thuần được lưu trong bài đăng (trình soạn thảo lưu văn bản thuần, không phải HTML).sanitized_contentlà nội dung sau khi xử lý riêng cho nền tảng. Trên hầu hết nền tảng, nội dung này giống bản gốc, ngoại trừ:- LinkedIn / LinkedIn Page: thay thế bằng ký tự Unicode in đậm/gạch chân nếu nguồn có thẻ
<strong>/<b>/<u>(do trình tạo AI sử dụng). - Mastodon: giữ lại một số thẻ HTML nội tuyến được phép (
p,strong,em,a,br,span).
- LinkedIn / LinkedIn Page: thay thế bằng ký tự Unicode in đậm/gạch chân nếu nguồn có thẻ
truncatedchỉ làtruekhi bước làm sạch thực sự làm giảm số byte, chẳng hạn khi giải mã HTML entity. Đây không phải dấu hiệu vượt giới hạn: nội dung quá dài sẽ bị từ chối khi đăng, không bị âm thầm cắt bớt. Để kiểm tra, hãy tự so sánhsanitized_lengthvớimax_content_length.
Phản hồi
{
"post_id": "9f1a2b3c-4d5e-6f7a-8b9c-0d1e2f3a4b5c",
"original_content": "Launch day!\n\nExcited to share what we built.",
"original_length": 44,
"platforms": [
{
"post_platform_id": "a1b2c3d4-e5f6-7a8b-9c0d-1e2f3a4b5c6d",
"platform": "x",
"content_type": "x_post",
"sanitized_content": "Launch day!\n\nExcited to share what we built.",
"sanitized_length": 44,
"max_content_length": 280,
"truncated": false
},
{
"post_platform_id": "b2c3d4e5-f6a7-8b9c-0d1e-2f3a4b5c6d7e",
"platform": "linkedin",
"content_type": "linkedin_post",
"sanitized_content": "Launch day!\n\nExcited to share what we built.",
"sanitized_length": 44,
"max_content_length": 3000,
"truncated": false
}
]
}
curl https://app.getkavio.app/api/posts/9f1a2b3c-4d5e-6f7a-8b9c-0d1e2f3a4b5c/preview \
-H "Authorization: Bearer YOUR_API_KEY"

