Entity — Connect# Giai đoạn cuối cùng: Đăng nhập lại để gắn các link social (Twitter, Facebook, LinkedIn, YouTube) vào profile nhằm tăng độ trust và sức mạnh SEO cho Entity.
Base URL: https://manager.likepion.com/api/v1/entity
1. Lấy danh sách task
Test
# curl -X GET 'https://manager.likepion.com/api/v1/entity/links?limit=5&status=connect' \
-H 'X-API-Key: <api_key>' Param Mặc định Mô tả limit5 Số task muốn pull (tối đa 1000) status— Lọc theo trạng thái task (connect)
Response# {
"success" : true ,
"data" : [
{
"id" : "a1b2c3d4-5678-90ab-cdef-1234567890ab" ,
"request_id" : "f0e1d2c3-b4a5-6789-0abc-def123456789" ,
"domain" : "example-social.com" ,
"website" : "https://likepion.com" ,
"email" : "socuser@gmail.com" ,
"username" : "socuser01" ,
"pass_mail" : "xxxx xxxx xxxx xxxx" ,
"twofa" : "JBSWY3DPEHPK3PXP" ,
"app_password" : "xxxx xxxx xxxx xxxx" ,
"password" : "Abc123!@xyzQ" ,
"entity_connect" : [
"https://entity-site-1.com/author/seouser01/" ,
"https://entity-site-2.com/profile/seouser01" ,
"https://entity-site-3.com/members/seouser01"
]
}
]
} Giải thích fields# Field Mô tả idID task — dùng khi gọi start/complete/fail request_idID request cha domainSite cần cập nhật liên kết websiteWebsite khách hàng email / usernameEmail / username đăng nhập pass_mail / twofa / app_passwordCredentials Gmail + TOTP + app password passwordMật khẩu tài khoản entity_connectDanh sách URL cần chèn vào profile. Assign tính dựa vào field entity_connect (jsonb) của request — xem bảng dưới
Logic tạo entity_connect (response)# Assign đọc field entity_connect (jsonb) trên entity_request và compute thành array URL:
entity_connect (DB config)Kết quả entity_connect (response) {"mode":"all"}Tất cả link_profile (không rỗng) của các task cùng request_id, order created_at ASC, max 150 {"mode":"disable"}Không có phase connect — Assign mark request completed thẳng sau phase register {"mode":"limit","limit":4}Top N link_profile cùng request (N = limit) {"mode":"custom","link":["https://a","https://b"]}Dùng trực tiếp mảng URL trong link
2. Lấy chi tiết task
Test
# Lấy thông tin 1 task theo id. Không thay đổi DB.
Query param Bắt buộc Mô tả statusVerify task đang ở status mong đợi. Nếu task hiện KHÔNG ở status này → 404 (tránh worker xử lý nhầm phase).
curl -X GET 'https://manager.likepion.com/api/v1/entity/links/<task_id>?status=connect' \
-H 'X-API-Key: <api_key>' Response# Trả về 1 object (không bọc trong mảng) — schema giống bước 1, gồm 11 field credentials + entity_connect.
{
"success" : true ,
"data" : {
"id" : "a1b2c3d4-5678-90ab-cdef-1234567890ab" ,
"request_id" : "f0e1d2c3-b4a5-6789-0abc-def123456789" ,
"domain" : "example-social.com" ,
"website" : "https://likepion.com" ,
"email" : "socuser@gmail.com" ,
"username" : "socuser01" ,
"pass_mail" : "xxxx xxxx xxxx xxxx" ,
"twofa" : "JBSWY3DPEHPK3PXP" ,
"app_password" : "xxxx xxxx xxxx xxxx" ,
"password" : "Abc123!@xyzQ" ,
"entity_connect" : [
"https://entity-site-1.com/author/seouser01/" ,
"https://entity-site-2.com/profile/seouser01" ,
"https://entity-site-3.com/members/seouser01"
]
}
} Code Response Khi nào 404 {"success": false, "message": "task not found"}Task không tồn tại / đã soft-delete 404 {"success": false, "message": "task not in expected status", "current_status": "register", "expected": "connect"}Task tồn tại nhưng status không khớp ?status=
3. Báo đang xử lý
Test
# Sau khi pull task, bắt buộc gọi API này để chuyển task từ connect → connecting.
Trạng thái trước Trạng thái sau connectconnecting
Lưu ý: API chỉ chấp nhận task có status = connect. Task ở trạng thái khác sẽ bị từ chối.
curl -X POST 'https://manager.likepion.com/api/v1/entity/links/<task_id>/start' \
-H 'X-API-Key: <api_key>' Response# 4. Báo hoàn thành
Test
# Báo connect thành công — task chuyển từ connecting → completed. Đây là bước cuối cùng của flow Entity.
Trạng thái trước Trạng thái sau connectingcompleted
curl -X POST 'https://manager.likepion.com/api/v1/entity/links/<task_id>/complete' \
-H 'X-API-Key: <api_key>' \
-H 'Content-Type: application/json' \
-d '{
"link_post": "https://example-site.com/profile/seouser01",
"note": "All 4 social links updated successfully"
}' Field Bắt buộc Mô tả link_postURL profile đã cập nhật (nếu connect thay đổi URL hoặc cần xác nhận lại). Bỏ qua nếu link giữ nguyên từ phase register. link_profileAlias của link_post — gửi field nào cũng được, BE chấp nhận cả 2 noteGhi chú (tuỳ chọn)
Response# 5. Báo thất bại
Test
# Task chuyển từ connecting → connect_failed. Retry manager sẽ tự động re-queue nếu retry_count < max_retries.
Trạng thái trước Trạng thái sau connectingconnect_failed
curl -X POST 'https://manager.likepion.com/api/v1/entity/links/<task_id>/fail' \
-H 'X-API-Key: <api_key>' \
-H 'Content-Type: application/json' \
-d '{
"error_message": "Profile is locked or restricted from editing"
}' Field Bắt buộc Mô tả error_message✔ Mô tả ngắn lỗi (≤1000 ký tự) noteGhi chú thêm
Response#