Tasks API#
Lấy tasks được giao và cập nhật trạng thái.
Base URL: https://apitest.likepion.com/api/v1
Auth: X-API-Key
GET /worker/tasks — Lấy tasks #
Query Parameters:
| Tham số | Mặc định | Mô tả |
|---|---|---|
page | 1 | Trang (offset pagination) |
limit | 100 | Số lượng (tối đa 1000) |
after | - | Cursor: ID cuối trang trước |
status | pending,queued | Lọc theo status |
service_type | - | entity, social, blog20, podcast, stacking, indexing |
Response (200):
{
"server_id": "uuid",
"server_name": "server-01",
"data": [
{
"id": "task-uuid-1",
"request_id": "request-uuid",
"service_type": "entity",
"site_id": "site-uuid",
"site_name": "example.com",
"email": "user@gmail.com",
"username": "user123",
"password": "pass123",
"about": "Bio text",
"link_profile": "",
"link_post": "",
"status": "pending",
"retry_count": 0,
"max_retries": 3,
"details": null,
"started_at": null,
"created_at": "2025-06-01T10:00:00Z",
"request_name": "Campaign A",
"request_website": "https://target.com",
"type_request": "normal",
"auction_price": 100,
"config": "{\"niche\":\"seo\",\"language\":\"en\"}"
}
],
"total": 150,
"page": 1,
"limit": 50,
"next_cursor": "task-uuid-50"
}Task fields#
| Field | Mô tả |
|---|---|
id | ID duy nhất của task |
request_id | ID campaign |
service_type | entity, social, blog20, podcast, stacking, indexing |
site_name | Site cần tạo profile/post |
email / username / password | Account đăng nhập site |
about | Bio/mô tả cho profile |
status | pending, queued, running, completed, failed, canceled |
retry_count / max_retries | Số lần retry / tối đa |
request_name | Tên campaign |
request_website | URL target website |
auction_price | Credits per link |
config | JSON config (niche, language…) |
PUT /worker/tasks/:id — Cập nhật 1 task #
Chỉ cập nhật được task thuộc server mình.
Request:
{
"status": "completed",
"link_profile": "https://example.com/profile/user123",
"link_post": "https://example.com/post/456",
"error_message": "",
"note": "",
"is_indexed": false
}| Field | Loại | Mô tả |
|---|---|---|
status | string | running, completed, failed, canceled |
link_profile | string | URL profile đã tạo |
link_post | string | URL bài đăng đã tạo |
error_message | string | Thông báo lỗi (khi failed) |
note | string | Ghi chú |
is_indexed | bool | Link đã index chưa |
Auto timestamps:
status = running→ setstarted_atstatus = completed/failed→ setcompleted_at
Response (200):
{"success": true, "data": {"updated": true, "link_id": "task-uuid-1"}}Errors:
403— Task không thuộc server này404— Task không tồn tại
PUT /worker/tasks/bulk — Cập nhật nhiều tasks (max 500) #
Request:
{
"items": [
{
"link_id": "uuid-1",
"status": "completed",
"link_profile": "https://example.com/profile/1",
"link_post": "https://example.com/post/1"
},
{
"link_id": "uuid-2",
"status": "failed",
"error_message": "Site blocked"
}
]
}Response (200):
{
"total": 2,
"success": 1,
"failed": 1,
"results": [
{"link_id": "uuid-1", "success": true},
{"link_id": "uuid-2", "success": false, "error": "not_your_task"}
]
}Task Status Flow#
pending → queued → running → completed
↓
failed → pending (retry)