WC_REST_WCCOM_Site_Installer_Controller::register_routes
Register the routes for plugin auto-installer.
Method of the class: WC_REST_WCCOM_Site_Installer_Controller{}
No Hooks.
Returns
null. Nothing (null).
Usage
$WC_REST_WCCOM_Site_Installer_Controller = new WC_REST_WCCOM_Site_Installer_Controller(); $WC_REST_WCCOM_Site_Installer_Controller->register_routes();
Changelog
| Since 7.7.0 | Introduced. |
WC_REST_WCCOM_Site_Installer_Controller::register_routes() WC REST WCCOM Site Installer Controller::register routes code WC 10.4.3
woocommerce/includes/wccom-site/rest-api/endpoints/class-wc-rest-wccom-site-installer-controller.php
public function register_routes() {
register_rest_route(
$this->namespace,
'/' . $this->rest_base . '/(?P<product_id>\d+)/state',
array(
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array( $this, 'get_product_install_state' ),
'permission_callback' => array( $this, 'check_permission' ),
'args' => array(
'product_id' => array(
'required' => true,
'type' => 'integer',
),
),
),
)
);
register_rest_route(
$this->namespace,
'/' . $this->rest_base,
array(
array(
'methods' => WP_REST_Server::EDITABLE,
'callback' => array( $this, 'install' ),
'permission_callback' => array( $this, 'check_permission' ),
'args' => array(
'product-id' => array(
'required' => true,
'type' => 'integer',
),
'run-until-step' => array(
'required' => true,
'type' => 'string',
'enum' => WC_WCCOM_Site_Installation_Manager::STEPS,
),
'idempotency-key' => array(
'required' => true,
'type' => 'string',
),
),
),
)
);
register_rest_route(
$this->namespace,
'/' . $this->rest_base . '/reset',
array(
array(
'methods' => WP_REST_Server::EDITABLE,
'callback' => array( $this, 'reset_install' ),
'permission_callback' => array( $this, 'check_permission' ),
'args' => array(
'product-id' => array(
'required' => true,
'type' => 'integer',
),
'idempotency-key' => array(
'required' => true,
'type' => 'string',
),
),
),
)
);
}