WC_API_Webhooks::register_routes()
Register the routes for this class
Method of the class: WC_API_Webhooks{}
No Hooks.
Return
Array
.
Usage
$WC_API_Webhooks = new WC_API_Webhooks(); $WC_API_Webhooks->register_routes( $routes );
- $routes(array) (required)
- -
Changelog
Since 2.2 | Introduced. |
WC_API_Webhooks::register_routes() WC API Webhooks::register routes code WC 7.7.0
public function register_routes( $routes ) { # GET|POST /webhooks $routes[ $this->base ] = array( array( array( $this, 'get_webhooks' ), WC_API_Server::READABLE ), array( array( $this, 'create_webhook' ), WC_API_Server::CREATABLE | WC_API_Server::ACCEPT_DATA ), ); # GET /webhooks/count $routes[ $this->base . '/count' ] = array( array( array( $this, 'get_webhooks_count' ), WC_API_Server::READABLE ), ); # GET|PUT|DELETE /webhooks/<id> $routes[ $this->base . '/(?P<id>\d+)' ] = array( array( array( $this, 'get_webhook' ), WC_API_Server::READABLE ), array( array( $this, 'edit_webhook' ), WC_API_Server::EDITABLE | WC_API_Server::ACCEPT_DATA ), array( array( $this, 'delete_webhook' ), WC_API_Server::DELETABLE ), ); # GET /webhooks/<id>/deliveries $routes[ $this->base . '/(?P<webhook_id>\d+)/deliveries' ] = array( array( array( $this, 'get_webhook_deliveries' ), WC_API_Server::READABLE ), ); # GET /webhooks/<webhook_id>/deliveries/<id> $routes[ $this->base . '/(?P<webhook_id>\d+)/deliveries/(?P<id>\d+)' ] = array( array( array( $this, 'get_webhook_delivery' ), WC_API_Server::READABLE ), ); return $routes; }