1. Documentation
  2. Advanced
  3. Rest API

Rest API

Since 1.6.5 update, GamiPress includes a full list of changes to completely bring support to WordPress rest API.

Important: For any question about WordPress rest API like endpoints, CRUD operations or authorization, please, check the official rest API handbook.

New endpoints

As described in our introduction document, GamiPress includes a bunch of elements to work with and GamiPress built-in rest API support offers endpoints for every of this elements.

In addition, GamiPress includes endpoints for the custom tables (logs and user earnings) to bring you access to perform CRUD operations with them too.

Types endpoints

GamiPress types (points types, achievement types and rank types) have each one their own endpoints.

Endpoints:

  • /wp/v2/points-type
  • /wp/v2/achievement-type
  • /wp/v2/rank-type

Important fields:

  • id: Unique identifier of the type’s post object.
  • slug: Identifies the type slug, used on single items endpoints (check “Achievement and ranks endpoints” section).

Achievement and ranks endpoints

Achievements and ranks will be accessible through their type endpoint, based on their type slug field.

Endpoints:

  • /wp/v2/{achievement-type-slug}
  • /wp/v2/{rank-type-slug}

Achievements example:
For the achievement type “Badge” with slug “badges”, endpoints will be /wp/v2/badges.
Ranks example:
For the rank type “Level” with slug “levels”, endpoints will be /wp/v2/levels.

Requirements endpoints

GamiPress requirements (points type awards and deducts, steps and rank requirements) have each one their own endpoints.

Endpoints:

  • /wp/v2/points-award
  • /wp/v2/points-deduct
  • /wp/v2/step
  • /wp/v2/rank-requirement

Important fields:

  • id: Unique identifier of the requirement’s post object.
  • parent: Post object that this requirement has been assigned to.

The parent field refers to a different post type object depending of the requirement:

  • points award or deduct parent refers to the points type post object.
  • step parent refers to the achievement post object.
  • rank requirement parent refers to the rank post object.

Custom tables endpoints

GamiPress logs and user earnings are stored on custom tables (outside the common WordPress posts table). It means their fields and structure will differ a bit from what WordPress offers on posts endpoints.

We put all our effort to make our custom tables match as much as posible the WordPress way in CRUD operations and retrieving the object on endpoints.

Endpoints:

More endpoints

Our Rest API Extended official add-on adds new rest API endpoints to extend interaction between your gamification environment and external applications.

In addition, you can take a look to the add-on documentation to check the new endpoints.

How can we help?