Blog 2.0 — Post#

Worker dùng credentials account (đã register sẵn trong DB) để đăng bài lên blog.

Base URL: https://manager.likepion.com/api/v1/blog20


1. Lấy danh sách task #

curl -X GET 'https://manager.likepion.com/api/v1/blog20/links?limit=5' \
  -H 'X-API-Key: <api_key>'

Response#

{
  "success": true,
  "data": [
    {
      "id": "b2c3d4e5-6789-01ab-cdef-234567890abc",
      "request_id": "f0e1d2c3-b4a5-6789-0abc-def123456789",
      "type_request": "post",
      "account_id": "a1b2c3d4-5678-9abc-def0-123456789abc",
      "group_id": "11112222-3333-4444-5555-666677778888",
      "content_type": "ai",
      "domain": "pixnet.net",
      "website": "https://likepion.com",
      "email": "realblog20@pixnet.com",
      "username": "realblog20user",
      "password": "realPwd123!",
      "pass_mail": "xxxx xxxx xxxx xxxx",
      "twofa": "JBSWY3DPEHPK3PXP",
      "app_password": "xxxx xxxx xxxx xxxx",
      "cookie": "PHPSESSID=abc123; user=xyz",
      "title": "10 Kỹ thuật SEO 2026",
      "about": "<article><h2>Giới thiệu</h2><p>SEO 2026... <a href=\"https://likepion.com/dich-vu\">dịch vụ SEO</a></p></article>",
      "images": [
        { "id": "uuid", "url": "https://s3.likepion.com/posts/cover.jpg" }
      ],
      "quick_link": "https://pixnet.net/blog/realuser/admin/new-post",
      "link_home": "https://pixnet.net/blog/realuser"
    }
  ]
}

Fields#

FieldMô tả
idID task
request_idID request cha
type_requestLuôn là post cho luồng này
account_idID account đã register sẵn (dùng để đăng bài)
group_idUUID group của blog20 — worker dùng để cluster account hoặc nhóm task cùng đợt
content_type"ai" (content do AI gen) hoặc "manual" (user nhập tay). Rỗng nếu chưa xác định. Worker dùng để route/log khác nhau nếu cần
domainNền tảng blog
websiteWebsite khách hàng
email / username / password / cookieCredentials account đã register sẵn
pass_mailMật khẩu Gmail/email
twofaBase32 secret TOTP (nếu có)
app_passwordApp password Gmail
titleTiêu đề bài
aboutNội dung bài HTML (đã xử lý spin, chứa anchor backlink)
imagesẢnh insert vào bài
quick_linkLink tắt đi thẳng tới trang đăng bài (admin)
link_homeLink trang chủ của blog (profile home)

2. Lấy chi tiết task #

Lấy thông tin 1 task cụ thể theo id. Không cần filter server/status. Không thay đổi DB.

curl -X GET 'https://manager.likepion.com/api/v1/blog_20/links/TASK_ID' \
  -H 'X-API-Key: <api_key>'

Response#

Trả về 1 object (không bọc trong mảng) — schema giống bước 1.

{ "success": true, "data": { ...task fields... } }

Nếu task không tồn tại hoặc đã soft-delete → HTTP 404 {"success": false, "message": "task not found"}.


3. Báo đang xử lý #

Sau khi pull task, bắt buộc gọi API này để chuyển task sang trạng thái running. Assign tự set started_at = NOW() (idempotent — gọi lại nhiều lần không đổi).

curl -X POST 'https://manager.likepion.com/api/v1/blog20/links/<task_id>/start' \
  -H 'X-API-Key: <api_key>'

Response#

{ "success": true }

4. Báo hoàn thành #

curl -X POST 'https://manager.likepion.com/api/v1/blog20/links/<task_id>/complete' \
  -H 'X-API-Key: <api_key>' \
  -H 'Content-Type: application/json' \
  -d '{"link_post": "https://pixnet.net/blog/realblog20user/post/98765"}'
FieldBắt buộcMô tả
link_postURL bài đăng

Response#

{ "success": true }

5. Báo thất bại #

curl -X POST 'https://manager.likepion.com/api/v1/blog20/links/<task_id>/fail' \
  -H 'X-API-Key: <api_key>' \
  -H 'Content-Type: application/json' \
  -d '{"error_message": "account banned"}'

Response#

{ "success": true }

6. Cập nhật tài khoản #

Dùng khi worker phát hiện account cần update trong lúc đang post — ví dụ cookie hết hạn cần refresh, account bị khoá / banned, hay muốn ghi note. Endpoint không thay đổi trạng thái task, chỉ update bản ghi account (blog20_account).

ACCOUNT_ID lấy từ field account_id trong response của bước 1.

curl -X PATCH 'https://manager.likepion.com/api/v1/blog20/accounts/<account_id>' \
  -H 'X-API-Key: <api_key>' \
  -H 'Content-Type: application/json' \
  -d '{
    "cookie": "PHPSESSID=newvalue; csrf=...",
    "status": "active",
    "note": "auto-refreshed after 401",
    "error_message": ""
  }'

Body — tất cả field đều optional (partial update)#

FieldMô tả
cookieCookie mới (chuỗi raw name=value; ...)
statusactive | inactive | banned | locked | expired — không gửi = giữ nguyên
noteGhi chú free-text (≤1000 ký tự)
error_messageLý do account fail (≤1000 ký tự). Truyền chuỗi rỗng "" để clear.

Yêu cầu ít nhất 1 field trong body. Field không gửi → không động đến giá trị cũ.

Response#

{
  "success": true,
  "updated": ["cookie", "status", "note"]
}

updated liệt kê các field thực sự đã ghi xuống DB.

Khi nào dùng#

Tình huốngHành động đề xuất
Cookie hết hạn → relogin lấy cookie mớicookie + status: "active"
Account bị site khoá tạm thờistatus: "locked", error_message: "..."
Account bị ban vĩnh viễnstatus: "banned", error_message: "..."
Cần đánh dấu để loại khỏi poolstatus: "inactive", note: "..."

Lưu ý: endpoint này không báo task hoàn thành/thất bại. Sau khi PATCH xong, worker vẫn phải gọi /complete hoặc /fail để đóng task hiện tại.