1. Documentation
  2. Rest API Extended
  3. Ranks Extended Controller

Ranks Extended Controller

Any endpoint of this controller requires an administrator logged in on rest API.
Check authentication chapter from WordPress rest API handbook for more information.

Get rank

Retrieve current rank of given user.

Arguments

user_id

User to retrieve rank.

rank_type

Rank type’s slug of rank to retrieve.

Definition

POST /wp/v2/gamipress/get-rank

Example Request

curl -X POST http://website.com/wp-json/wp/v2/gamipress/get-rank -d "user_id=1&rank_type=level"

Get next rank

Retrieve next reachable rank of given user. If there isn’t one will return the current one.

Arguments

user_id

User to retrieve rank.

rank_type

Rank type’s slug of rank to retrieve.

Definition

POST /wp/v2/gamipress/get-next-rank

Example Request

curl -X POST http://website.com/wp-json/wp/v2/gamipress/get-next-rank -d "user_id=1&rank_type=level"

Get previous rank

Retrieve previous reached rank of given user. If there isn’t one will return the current one.

Arguments

user_id

User to retrieve rank.

rank_type

Rank type’s slug of rank to retrieve.

Definition

POST /wp/v2/gamipress/get-previous-rank

Example Request

curl -X POST http://website.com/wp-json/wp/v2/gamipress/get-previous-rank -d "user_id=1&rank_type=level"

Award rank

Award the desired rank to the given user.

Arguments

user_id

User who rank will be awarded.

rank_id

Rank that will be awarded.

Definition

POST /wp/v2/gamipress/award-rank

Example Request

curl -X POST http://website.com/wp-json/wp/v2/gamipress/award-rank -d "user_id=1&rank_id=1"

Revoke rank

Revoke the desired rank to the given user.

Arguments

user_id

User who rank will be revoked.

rank_id

Rank that will be revoked.

new_rank_id

New rank that will be assigned to the user (Optional). By default, previous rank of the same type will be assigned.

Definition

POST /wp/v2/gamipress/revoke-rank

Example Request

curl -X POST http://website.com/wp-json/wp/v2/gamipress/revoke-rank -d "user_id=1&rank_id=1&new_rank_id=2"

Upgrade to next rank

Upgrade given user to the next rank if possible.

Arguments

user_id

User who rank will be upgraded.

rank_type

Rank type’s slug of rank to upgrade.

Definition

POST /wp/v2/gamipress/upgrade-to-next-rank

Example Request

curl -X POST http://website.com/wp-json/wp/v2/gamipress/upgrade-to-next-rank -d "user_id=1&rank_type=level"

Downgrade to previous rank

Downgrade given user to the previous rank if possible.

Arguments

user_id

User who rank will be downgraded.

rank_type

Rank type’s slug of rank to downgrade.

Definition

POST /wp/v2/gamipress/downgrade-to-previous-rank

Example Request

curl -X POST http://website.com/wp-json/wp/v2/gamipress/downgrade-to-previous-rank -d "user_id=1&rank_type=level"

Was this article helpful to you? Yes No

How can we help?