Skip to content

REST API

Gamification: 18 routes.

All under /wp-json/davo/v1. Every route has a description in the source.

  • GET18

/gamification/achievement-categories

GETPublic

Returns { slug, label } pairs rather than bare slugs — a slug like 'daily_activity' isn't translatable display text on its own, and the frontend has no business hardcoding a slug -> label map that would drift out of sync with what's actually registered server-side. Labels come from Gamification_Registry::get_achievement_categories(), which every category slug in use is registered against in Gamification_Initializer::register_achievements().

Handler: get_achievement_categories()

No parameters declared in the route registration.

curl
curl "https://example.com/wp-json/davo/v1/gamification/achievement-categories"

src/domains/gamification/routes.php:311

/gamification/achievements

GETPublic

Mirrors GET /gamification/challenges exactly: definitions are configuration data (rarely changes), kept separate from per-user progress state. The frontend merges this catalogue with /users/{id}/achievements or /me/gamification/achievements client-side, matching on 'id' (definition) against 'achievement_id' (state row). Paginated in-memory (see paginate_array()) rather than at the database layer, since achievement definitions live in Gamification_Registry, not a table — but the response still carries the same X-WP-Total / X-WP-TotalPages headers as every other paginated list endpoint in this domain, so API consumers don't need to know the difference.

Handler: get_registered_achievements()

No parameters declared in the route registration.

curl
curl "https://example.com/wp-json/davo/v1/gamification/achievements"

src/domains/gamification/routes.php:324

/gamification/challenges

GETPublic

Paginated in-memory — see get_registered_achievements()'s docblock for the full rationale, which applies identically here.

Handler: get_registered_challenges()

No parameters declared in the route registration.

curl
curl "https://example.com/wp-json/davo/v1/gamification/challenges"

src/domains/gamification/routes.php:338

/gamification/dashboard-stats

GETAccess check: require_admin

Callback: GET /gamification/dashboard-stats — aggregate stats for the admin dashboard. Administrator-only (see require_admin()) — this exposes the full site-wide reputation/XP economy, not something a regular viewer or even a content moderator needs.

Handler: cb_get_dashboard_stats()

Parameters of GET /gamification/dashboard-stats
ParameterTypeRequiredDefault or allowed values
daysinteger—30
curl
curl -u "user:application-password" "https://example.com/wp-json/davo/v1/gamification/dashboard-stats"

src/domains/gamification/routes.php:991

/gamification/levels

GETPublic

GET /gamification/levels — Return all registered levels.

Handler: get_levels()

No parameters declared in the route registration.

curl
curl "https://example.com/wp-json/davo/v1/gamification/levels"

src/domains/gamification/routes.php:298

/gamification/ranks

GETPublic

GET /gamification/ranks — Return all registered ranks.

Handler: get_ranks()

No parameters declared in the route registration.

curl
curl "https://example.com/wp-json/davo/v1/gamification/ranks"

src/domains/gamification/routes.php:285

/gamification/users

GETPublic

Public and capability-free by design — see register_user_display_routes()'s docblock for why this exists as its own domain-owned endpoint rather than relying on /wp/v2/users.

Handler: get_users_display_data()

Parameters of GET /gamification/users
ParameterTypeRequiredDefault or allowed values
includearrayYes—
curl
curl "https://example.com/wp-json/davo/v1/gamification/users?include=[]"

src/domains/gamification/routes.php:459

/leaderboards

GETPublic

GET /leaderboards — Return all registered leaderboard board definitions.

Handler: get_leaderboard_list()

No parameters declared in the route registration.

curl
curl "https://example.com/wp-json/davo/v1/leaderboards"

src/domains/gamification/routes.php:388

/leaderboards/{slug}

GETPublic

GET /leaderboards/{slug} — Return a paginated leaderboard page.

Handler: get_leaderboard_page()

Parameters of GET /leaderboards/{slug}
ParameterTypeRequiredDefault or allowed values
slugstringYes—
periodstring—alltime | weekly | monthly
pageinteger—1
per_pageinteger—20
curl
curl "https://example.com/wp-json/davo/v1/leaderboards/{slug}"

src/domains/gamification/routes.php:401

/me/gamification

GETAccess check: require_login

GET /me/gamification — Return the gamification summary for the current user.

Handler: get_me_summary()

No parameters declared in the route registration.

curl
curl -u "user:application-password" "https://example.com/wp-json/davo/v1/me/gamification"

src/domains/gamification/routes.php:73

/me/gamification/achievements

GETAccess check: require_login

GET /me/gamification/achievements — Return all achievements with progress for the current user.

Handler: get_me_achievements()

No parameters declared in the route registration.

curl
curl -u "user:application-password" "https://example.com/wp-json/davo/v1/me/gamification/achievements"

src/domains/gamification/routes.php:112

/me/gamification/challenges

GETAccess check: require_login

GET /me/gamification/challenges — Return current period challenges for the current user.

Handler: get_me_challenges()

No parameters declared in the route registration.

curl
curl -u "user:application-password" "https://example.com/wp-json/davo/v1/me/gamification/challenges"

src/domains/gamification/routes.php:99

/me/gamification/permissions

GETAccess check: require_login

GET /me/gamification/permissions — Return the permission map for the current user.

Handler: get_me_permissions()

No parameters declared in the route registration.

curl
curl -u "user:application-password" "https://example.com/wp-json/davo/v1/me/gamification/permissions"

src/domains/gamification/routes.php:86

/users/{id}/achievements

GETAccess check: require_existing_user

Hidden/secret achievements (e.g. 'early_supporter', 'beta_tester') are omitted from the response entirely when they are not yet unlocked and the requester is neither the profile owner nor an admin — a viewer should not be able to discover a secret achievement exists just by seeing a locked row for it. Once unlocked, a hidden achievement is visible to everyone, same as any public one; hiding it permanently even after unlock would make earning it pointless to show off. This was previously a known gap (flagged during the production audit): this endpoint returned identical data regardless of viewer.

Handler: get_user_achievements()

Parameters of GET /users/{id}/achievements
ParameterTypeRequiredDefault or allowed values
idintegerYes—
curl
curl -u "user:application-password" "https://example.com/wp-json/davo/v1/users/{id}/achievements"

src/domains/gamification/routes.php:226

/users/{id}/achievements/{achievement_id}

GETAccess check: require_existing_user

Returns 404 rather than the row itself when the achievement is hidden, not yet unlocked, and the requester is neither the owner nor an admin — same rationale as get_user_achievements() above. A 404 here (rather than a filtered/empty 200) avoids confirming or denying whether the achievement ID is even valid to an unauthorized viewer.

Handler: get_user_achievement()

Parameters of GET /users/{id}/achievements/{achievement_id}
ParameterTypeRequiredDefault or allowed values
idintegerYes—
achievement_idstringYes—
curl
curl -u "user:application-password" "https://example.com/wp-json/davo/v1/users/{id}/achievements/{achievement_id}"

src/domains/gamification/routes.php:249

/users/{id}/gamification

GETAccess check: require_existing_user

GET /users/{id}/gamification — Return the gamification summary for any user.

Handler: get_user_summary()

Parameters of GET /users/{id}/gamification
ParameterTypeRequiredDefault or allowed values
idintegerYes—
curl
curl -u "user:application-password" "https://example.com/wp-json/davo/v1/users/{id}/gamification"

src/domains/gamification/routes.php:132

/users/{id}/reputation-history

GETAccess check: require_own_user_or_admin

GET /users/{id}/reputation-history — Return the paginated ledger for a user.

Handler: get_reputation_history()

Parameters of GET /users/{id}/reputation-history
ParameterTypeRequiredDefault or allowed values
idintegerYes—
pageinteger—1
per_pageinteger—20
reasonstring——
source_typestring——
curl
curl -u "user:application-password" "https://example.com/wp-json/davo/v1/users/{id}/reputation-history"

src/domains/gamification/routes.php:155

/users/{id}/statistics

GETAccess check: require_existing_user

GET /users/{id}/statistics — Return full statistics for any user.

Handler: get_user_statistics()

Parameters of GET /users/{id}/statistics
ParameterTypeRequiredDefault or allowed values
idintegerYes—
curl
curl -u "user:application-password" "https://example.com/wp-json/davo/v1/users/{id}/statistics"

src/domains/gamification/routes.php:203

Note. Generated from the plugin source. Parameters are the ones declared when the route is registered; a parameter marked “see source” uses a shared definition. Responses are not documented here. Authenticate as for any WordPress REST route, for example with an application password over HTTPS; the example paths use https://example.com.

See it on your own site.

Davo is a WordPress theme and plugin by Exorex.

  • Runs on your own WordPress
  • Guided setup wizard
  • AI is off until you switch it on
  • Read the licence on the marketplace first