WC_API
extends WC_Legacy_API
in package
WC_API class.
Table of Contents
- VERSION = '3.1.0'
- This is the major version for the REST API and takes first-order position in endpoint URLs.
- $authentication : WC_API_Authentication
- REST API authentication class instance.
- $server : WC_API_Server
- The REST API server.
- add_endpoint() : mixed
- WC API for payment gateway IPNs, etc.
- add_query_vars() : array<string|int, string>
- Add new query vars.
- get_endpoint_data() : array<string|int, mixed>|WP_Error
- Get data from a WooCommerce API endpoint.
- get_rest_api_package_path() : string
- Get the version of the REST API package being ran.
- get_rest_api_package_version() : string|null
- Get the version of the REST API package being ran. Since API package was merged into core, this now follows WC version.
- handle_api_requests() : mixed
- API request - Trigger any API requests.
- handle_rest_api_requests() : mixed
- Handle REST API requests.
- includes() : mixed
- Include required files for REST API request.
- init() : mixed
- Init the API by setting up action and filter hooks.
- register_resources() : mixed
- Register available API resources.
- register_rest_routes() : mixed
- Register REST API routes.
- register_wp_admin_settings() : mixed
- Register WC settings from WP-API to the REST API.
- rest_api_includes() : mixed
- Include REST API classes.
- rest_api_init() : mixed
- Rest API Init.
- is_rest_api_loaded() : bool
- Return if the rest API classes were already loaded.
- handle_v1_rest_api_request() : mixed
- Handle legacy v1 REST API requests.
- handle_v2_rest_api_request() : mixed
- Handle legacy v2 REST API requests.
Constants
VERSION
This is the major version for the REST API and takes first-order position in endpoint URLs.
public
string
VERSION
= '3.1.0'
Tags
Properties
$authentication
REST API authentication class instance.
public
WC_API_Authentication
$authentication
Tags
$server
The REST API server.
public
WC_API_Server
$server
Tags
Methods
add_endpoint()
WC API for payment gateway IPNs, etc.
public
static add_endpoint() : mixed
Tags
Return values
mixed —add_query_vars()
Add new query vars.
public
add_query_vars(array<string|int, mixed> $vars) : array<string|int, string>
Parameters
- $vars : array<string|int, mixed>
-
Query vars.
Tags
Return values
array<string|int, string> —get_endpoint_data()
Get data from a WooCommerce API endpoint.
public
get_endpoint_data(string $endpoint[, array<string|int, mixed> $params = array() ]) : array<string|int, mixed>|WP_Error
Parameters
- $endpoint : string
-
Endpoint.
- $params : array<string|int, mixed> = array()
-
Params to passwith request.
Tags
Return values
array<string|int, mixed>|WP_Error —get_rest_api_package_path()
Get the version of the REST API package being ran.
public
get_rest_api_package_path() : string
Tags
Return values
string —get_rest_api_package_version()
Get the version of the REST API package being ran. Since API package was merged into core, this now follows WC version.
public
get_rest_api_package_version() : string|null
Tags
Return values
string|null —handle_api_requests()
API request - Trigger any API requests.
public
handle_api_requests() : mixed
Tags
Return values
mixed —handle_rest_api_requests()
Handle REST API requests.
public
handle_rest_api_requests() : mixed
Tags
Return values
mixed —includes()
Include required files for REST API request.
public
includes() : mixed
Tags
Return values
mixed —init()
Init the API by setting up action and filter hooks.
public
init() : mixed
Return values
mixed —register_resources()
Register available API resources.
public
register_resources(WC_API_Server $server) : mixed
Parameters
- $server : WC_API_Server
-
the REST server.
Tags
Return values
mixed —register_rest_routes()
Register REST API routes.
public
register_rest_routes() : mixed
Tags
Return values
mixed —register_wp_admin_settings()
Register WC settings from WP-API to the REST API.
public
register_wp_admin_settings() : mixed
Tags
Return values
mixed —rest_api_includes()
Include REST API classes.
public
rest_api_includes() : mixed
Tags
Return values
mixed —rest_api_init()
Rest API Init.
public
rest_api_init() : mixed
Tags
Return values
mixed —is_rest_api_loaded()
Return if the rest API classes were already loaded.
protected
is_rest_api_loaded() : bool
Tags
Return values
bool —handle_v1_rest_api_request()
Handle legacy v1 REST API requests.
private
handle_v1_rest_api_request() : mixed
Tags
Return values
mixed —handle_v2_rest_api_request()
Handle legacy v2 REST API requests.
private
handle_v2_rest_api_request() : mixed