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 địnhMô tả
page1Trang (offset pagination)
limit100Số lượng (tối đa 1000)
after-Cursor: ID cuối trang trước
statuspending,queuedLọ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#

FieldMô tả
idID duy nhất của task
request_idID campaign
service_typeentity, social, blog20, podcast, stacking, indexing
site_nameSite cần tạo profile/post
email / username / passwordAccount đăng nhập site
aboutBio/mô tả cho profile
statuspending, queued, running, completed, failed, canceled
retry_count / max_retriesSố lần retry / tối đa
request_nameTên campaign
request_websiteURL target website
auction_priceCredits per link
configJSON 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
}
FieldLoạiMô tả
statusstringrunning, completed, failed, canceled
link_profilestringURL profile đã tạo
link_poststringURL bài đăng đã tạo
error_messagestringThông báo lỗi (khi failed)
notestringGhi chú
is_indexedboolLink đã index chưa

Auto timestamps:

  • status = running → set started_at
  • status = completed / failed → set completed_at

Response (200):

{"success": true, "data": {"updated": true, "link_id": "task-uuid-1"}}

Errors:

  • 403 — Task không thuộc server này
  • 404 — 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)