Quest · API Reference

API — Quest

Tài liệu các endpoint của module quest. Mỗi endpoint có request format, response format, lỗi có thể xảy ra và ví dụ thực tế.

Tóm tắt endpoint

MethodPathMô tảAuthRate limit
GET/api/v1/quests/dailyLấy daily quests và recount progress.BearerGlobal apiLimiter; một số flow có Redis/domain limit riêng.
POST/api/v1/quests/:code/claimClaim karma reward nếu complete.BearerGlobal apiLimiter; một số flow có Redis/domain limit riêng.

GET /api/v1/quests/daily

GET Auth required apiLimiter

Endpoint này dùng để lấy daily quests và recount progress. Gọi endpoint này khi client cần thao tác đúng phạm vi module quest.

Request

HeaderGiá trịBắt buộcMô tả
AuthorizationBearer accessTokenJWT access token nếu route protected
x-refresh-tokenraw refresh tokenKhôngRefresh token header theo middleware
ParameterKiểuMô tảVí dụ
path paramsstringCác phần :publicId, :username, :code nếu path cócm123
query paramsstring/numbertake, after, page, limit hoặc module-specific querytake=20
FieldKiểuBắt buộcValidationMô tảVí dụ giá trị
bodyobjectKhôngTheo DTO Zod nếu route có validate()Payload nghiệp vụ của endpoint{"content":"Hello"}
Ví dụ request
curl -X GET http://localhost:3302/api/v1/quests/daily \
  -H "Authorization: Bearer ACCESS_TOKEN" \
  -H "Content-Type: application/json"

Response

200/201 — Thành công

FieldKiểuLuôn có?Mô tả
successbooleantrue khi request thành công
messagestringKhôngMột số controller truyền message
dataobject/arrayTùy endpointDữ liệu trả về từ service
paginationobjectVới listCursor/offset pagination
{
  "success": true,
  "data": {
    "module": "quest",
    "endpoint": "/api/v1/quests/daily"
  }
}

Lỗi có thể xảy ra

HTTP StatusError CodeKhi nào xảy raCách xử lý ở client
401UNAUTHORIZEDUnauthorizedLogin lại hoặc refresh token.
400VALIDATION_FAILEDValidation failedClient sửa field sai.
404NOT_FOUNDResource not foundRefresh dữ liệu.
403FORBIDDENForbiddenẨn action trong UI.
500INTERNAL_SERVER_ERRORExternal dependency failOn-call kiểm tra provider/log.
Ví dụ lỗi
{
  "success": false,
  "message": "Validation failed"
}

Ghi chú

POST /api/v1/quests/:code/claim

POST Auth required apiLimiter

Endpoint này dùng để claim karma reward nếu complete. Gọi endpoint này khi client cần thao tác đúng phạm vi module quest.

Request

HeaderGiá trịBắt buộcMô tả
AuthorizationBearer accessTokenJWT access token nếu route protected
x-refresh-tokenraw refresh tokenKhôngRefresh token header theo middleware
ParameterKiểuMô tảVí dụ
path paramsstringCác phần :publicId, :username, :code nếu path cócm123
query paramsstring/numbertake, after, page, limit hoặc module-specific querytake=20
FieldKiểuBắt buộcValidationMô tảVí dụ giá trị
bodyobjectTùy endpointTheo DTO Zod nếu route có validate()Payload nghiệp vụ của endpoint{"content":"Hello"}
Ví dụ request
curl -X POST http://localhost:3302/api/v1/quests/POST_1/claim \
  -H "Authorization: Bearer ACCESS_TOKEN" \
  -H "Content-Type: application/json"

Response

200/201 — Thành công

FieldKiểuLuôn có?Mô tả
successbooleantrue khi request thành công
messagestringKhôngMột số controller truyền message
dataobject/arrayTùy endpointDữ liệu trả về từ service
paginationobjectVới listCursor/offset pagination
{
  "success": true,
  "data": {
    "module": "quest",
    "endpoint": "/api/v1/quests/:code/claim"
  }
}

Lỗi có thể xảy ra

HTTP StatusError CodeKhi nào xảy raCách xử lý ở client
401UNAUTHORIZEDUnauthorizedLogin lại hoặc refresh token.
400VALIDATION_FAILEDValidation failedClient sửa field sai.
404NOT_FOUNDResource not foundRefresh dữ liệu.
403FORBIDDENForbiddenẨn action trong UI.
500INTERNAL_SERVER_ERRORExternal dependency failOn-call kiểm tra provider/log.
Ví dụ lỗi
{
  "success": false,
  "message": "Validation failed"
}

Ghi chú