Response Examples

Struktur envelope response universal DYOGG — success, error, pagination, batch.

Envelope success

Semua response 2xx mengikuti pola:

{
  "data": { /* payload utama — object atau array */ },
  "meta": {
    "cache": "hit",
    "ttl_seconds": 60,
    "request_id": "req_01H8YZABCDEF...",
    "api_version": "v1",
    "server_time": "2026-07-22T12:34:56Z"
  }
}

Envelope error

Semua response 4xx/5xx:

{
  "error": {
    "code": "player_not_found",
    "message": "UID 816973814 tidak ditemukan atau showcase disembunyikan.",
    "field": null,
    "docs_url": "https://dyogg.com/docs/error-codes#player_not_found"
  },
  "meta": {
    "request_id": "req_01H8YZ...",
    "api_version": "v1",
    "server_time": "2026-07-22T12:34:56Z"
  }
}

Pagination

Cursor-based:

{
  "data": [ /* items */ ],
  "meta": {
    "cursor_next": "cur_eyJpZCI6MjQ1fQ",
    "cursor_prev": null,
    "total_hint": "≥12500",
    "limit": 50
  }
}

Untuk next page: GET /v1/leaderboard/genshin/10000098?cursor=cur_eyJpZCI6MjQ1fQ&limit=50.

Batch

Response batch (mis. POST /v1/players/batch):

{
  "data": [
    { "uid": "816973814", "status": "ok", "player": { /* ... */ } },
    { "uid": "816973999", "status": "error", "error": { "code": "not_found" } }
  ],
  "meta": { "fetched": 1, "cached": 0, "failed": 1 }
}

Sparse fieldset

Kirim ?fields=id,name,level untuk hanya ambil field tertentu — hemat bandwidth.

{
  "data": { "id": 10000098, "name": "Flins", "level": 90 }
}

Content negotiation

  • Accept: application/json (default).
  • Accept: application/x-ndjson — streaming ndjson untuk endpoint list besar (mis. leaderboard).
  • Accept-Encoding: gzip, br — automatic response compression.