Constants

VERSION

VERSION

Properties

$log_requests

$log_requests : boolean|mixed|void

Type

boolean|mixed|void

$pretty_print

$pretty_print : boolean|integer|null

Type

boolean|integer|null

$is_valid_request

$is_valid_request : boolean

Type

boolean

$user_id

$user_id : integer

Type

integer

$stats

$stats : 

Type

$data

$data : array

Type

array

$override

$override : boolean

Type

boolean

Methods

__construct()

__construct() 

REST_API constructor.

add_endpoint()

add_endpoint(  $rewrite_rules) 

Registers a new rewrite endpoint for accessing the API

Parameters

$rewrite_rules

query_vars()

query_vars(  $vars) : array

Registers query vars for API access

Parameters

$vars

Returns

array

get_user()

get_user(string  $key = '') : boolean|mixed|null|string

Retrieve the user ID based on the public key provided

Parameters

string $key

Returns

boolean|mixed|null|string

process_query()

process_query() 

Listens for the API and then processes the API requests

get_stats()

get_stats(  $args) : array|mixed|void

Get some stats

Parameters

$args

Returns

array|mixed|void

update_user()

update_user(  $args) : array

Update user API query

Parameters

$args

Returns

array

get_users()

get_users(  $args) : array

Process Get users API Request

Parameters

$args

Returns

array

delete_user()

delete_user(  $args) : array

Process delete user via API

Parameters

$args

Returns

array

get_auser()

get_auser(  $args) : array|mixed|void

Process Get user API Request

Parameters

$args

Returns

array|mixed|void

getsrc()

getsrc(  $image) : string

Get source

Parameters

$image

Returns

string

get_query_mode()

get_query_mode() : null

Determines the kind of query requested and also ensure it is a valid query

Returns

null

get_paged()

get_paged() 

Get page number

get_output_format()

get_output_format() 

Retrieve the output format

get_output()

get_output() 

Retrieve the output data

output()

output(  $status_code = 200) 

Output Query in either JSON/XML. The query data is outputted as JSON by default

Parameters

$status_code

user_key_field()

user_key_field(  $content,   $user) : string

Modify User Profile Page fields

Parameters

$content
$user

Returns

string

generate_api_key()

generate_api_key(integer  $user_id, boolean  $regenerate = false) : boolean

Generate new API keys for a user

Parameters

integer $user_id
boolean $regenerate

Returns

boolean

revoke_api_key()

revoke_api_key(integer  $user_id) : boolean

Revoke a users API keys

Parameters

integer $user_id

Returns

boolean

update_key()

update_key(  $user_id) 

Generate and Save API key

Parameters

$user_id

validate_request()

validate_request() 

Validate the API request

missing_auth()

missing_auth() 

Displays a missing authentication error if all the parameters aren't provided

invalid_auth()

invalid_auth() 

Displays an authentication failed error if the user failed to provide valid credentials

invalid_key()

invalid_key() 

Displays an invalid API key error if the API key provided couldn't be validated

log_request()

log_request(array  $data = array()) 

Log each API request, if enabled

Parameters

array $data

generate_public_key()

generate_public_key(string  $user_email = '') : string

Generate the public key for a user

Parameters

string $user_email

Returns

string

generate_private_key()

generate_private_key(integer  $user_id) : string

Generate the secret key for a user

Parameters

integer $user_id

Returns

string

get_token()

get_token(integer  $user_id) : string

Retrieve the user's token

Parameters

integer $user_id

Returns

string