1. Documentation
  2. Rest API
  3. User Earnings Controller

User Earnings 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.

Schema

The schema defines all the fields that exist for a user earning object.

id

integer

Unique identifier for the object.

Context: view, edit, embed

meta

object

Meta fields.

Context: view, edit

title

string

The title for the object.

Context: view, edit, embed

user_id

integer

The ID for the user of the object.

Context: view, edit, embed

post_id

integer

The ID for the post of the object.

Context: view, edit, embed

post_type

string

The type for the post of the object.

Context: view, edit, embed

points

integer

The points amount of the object.

Context: view, edit, embed

points_type

string

The type for the points amount of the object.

Context: view, edit, embed

date

string

The date the object was created, in the site's timezone.

Context: view, edit, embed

Example Request

curl -X OPTIONS -i http://website.com/wp-json/wp/v2/gamipress-user-earnings

List User Earnings

Arguments

context

Scope under which the request is made; determines fields present in response.

Default: view

One of: view, embed, edit

page

Current page of the collection.

Default: 1

per_page

Maximum number of items to be returned in result set.

Default: 10

offset

Offset the result set by a specific number of items.

order

Order sort attribute ascending or descending.

Default: desc

One of: asc, desc

orderby

Sort collection by object attribute.

Default: user_earning_id

One of: user_earning_id, title, user_id, post_id, post_type, points, points_type, date, include, relevance

user_id

Limit result set to earnings assigned to specific users.

post_id

Limit result set to earnings assigned to specific posts.

post_type

Limit result set to earnings assigned to specific post types.

points_type

Limit result set to earnings assigned to specific points types.

force_types

Setting it to true will force to limit results of the same post_type and points_type.

exclude

Ensure result set excludes specific IDs.

include

Limit result set to specific IDs.

after

Limit response to user earnings after a given ISO8601 compliant date.

before

Limit response to user earnings before a given ISO8601 compliant date.

Definition

GET /wp/v2/gamipress-user-earnings

Example Request

curl -X GET http://website.com/wp-json/wp/v2/gamipress-user-earnings -d "search=test&order=desc"

Create a User Earning

Arguments

meta

Meta fields.

title

The title for the object.

user_id

The ID for the user of the object.

post_id

The ID for the post of the object.

post_type

The type for the post of the object.

points

The points amount of the object.

points_type

The type for the points amount of the object.

date

The date the object was created, in the site's timezone.

Definition

POST /wp/v2/gamipress-user-earnings

Example Request

curl -X POST http://website.com/wp-json/wp/v2/gamipress-user-earnings -d "title=test&user_id=1"

Retrieve a User Earning

Arguments

id Unique identifier for the object.
context

Scope under which the request is made; determines fields present in response.

Default: view

One of: view, embed, edit

Definition

GET /wp/v2/gamipress-user-earnings/<id>

Example Request

curl -X GET http://demo.wp-api.org/wp-json/wp/v2/gamipress-user-earnings/<id>

Update a User Earning

Arguments

id

Unique identifier for the object.

meta

Meta fields.

title

The title for the object.

user_id

The ID for the user of the object.

post_id

The ID for the post of the object.

post_type

The type for the post of the object.

points

The points amount of the object.

points_type

The type for the points amount of the object.

date

The date the object was created, in the site's timezone.

Definition

POST /wp/v2/gamipress-user-earnings/<id>

Example Request

curl -X POST http://website.com/wp-json/wp/v2/gamipress-user-earnings/<id> -d "title=test&user_id=1"

Delete a User Earning

Arguments

id Unique identifier for the object.

Definition

DELETE /wp/v2/gamipress-user-earnings/<id>

Example Request

curl -X DELETE http://demo.wp-api.org/wp-json/wp/v2/gamipress-user-earnings/<id>

How can we help?