Automattic\WooCommerce\Admin\API
Marketing::register_routes
Register routes.
Method of the class: Marketing{}
No Hooks.
Returns
null. Nothing (null).
Usage
$Marketing = new Marketing(); $Marketing->register_routes();
Marketing::register_routes() Marketing::register routes code WC 10.3.6
public function register_routes() {
register_rest_route(
$this->namespace,
'/' . $this->rest_base . '/recommended',
array(
array(
'methods' => \WP_REST_Server::READABLE,
'callback' => array( $this, 'get_recommended_plugins' ),
'permission_callback' => array( $this, 'get_recommended_plugins_permissions_check' ),
'args' => array(
'per_page' => $this->get_collection_params()['per_page'],
'category' => array(
'type' => 'string',
'validate_callback' => 'rest_validate_request_arg',
'sanitize_callback' => 'sanitize_title_with_dashes',
),
),
),
'schema' => array( $this, 'get_public_item_schema' ),
)
);
register_rest_route(
$this->namespace,
'/' . $this->rest_base . '/knowledge-base',
array(
array(
'methods' => \WP_REST_Server::READABLE,
'callback' => array( $this, 'get_knowledge_base_posts' ),
'permission_callback' => array( $this, 'get_items_permissions_check' ),
'args' => array(
'category' => array(
'type' => 'string',
'validate_callback' => 'rest_validate_request_arg',
'sanitize_callback' => 'sanitize_title_with_dashes',
),
),
),
'schema' => array( $this, 'get_public_item_schema' ),
)
);
register_rest_route(
$this->namespace,
'/' . $this->rest_base . '/misc-recommendations',
array(
array(
'methods' => \WP_REST_Server::READABLE,
'callback' => array( $this, 'get_misc_recommendations' ),
'permission_callback' => array( $this, 'get_recommended_plugins_permissions_check' ),
),
'schema' => array( $this, 'get_public_item_schema' ),
)
);
}