WC_API_Products::register_routes() │ public │ WC 2.1
Register the routes for this class
GET/POST /products GET /products/count GET/PUT/DELETE /products/<id> GET /products/<id>/reviews
Метод класса: WC_API_Products{}
Хуков нет.
Возвращает
Массив
.
Использование
$WC_API_Products = new WC_API_Products(); $WC_API_Products->register_routes( $routes );
- $routes(массив) (обязательный)
- -
Список изменений
С версии 2.1 | Введена. |
Код WC_API_Products::register_routes() WC API Products::register routes WC 8.7.0
public function register_routes( $routes ) { # GET/POST /products $routes[ $this->base ] = array( array( array( $this, 'get_products' ), WC_API_Server::READABLE ), array( array( $this, 'create_product' ), WC_API_Server::CREATABLE | WC_API_Server::ACCEPT_DATA ), ); # GET /products/count $routes[ $this->base . '/count' ] = array( array( array( $this, 'get_products_count' ), WC_API_Server::READABLE ), ); # GET/PUT/DELETE /products/<id> $routes[ $this->base . '/(?P<id>\d+)' ] = array( array( array( $this, 'get_product' ), WC_API_Server::READABLE ), array( array( $this, 'edit_product' ), WC_API_Server::EDITABLE | WC_API_Server::ACCEPT_DATA ), array( array( $this, 'delete_product' ), WC_API_Server::DELETABLE ), ); # GET /products/<id>/reviews $routes[ $this->base . '/(?P<id>\d+)/reviews' ] = array( array( array( $this, 'get_product_reviews' ), WC_API_Server::READABLE ), ); # GET /products/<id>/orders $routes[ $this->base . '/(?P<id>\d+)/orders' ] = array( array( array( $this, 'get_product_orders' ), WC_API_Server::READABLE ), ); # GET/POST /products/categories $routes[ $this->base . '/categories' ] = array( array( array( $this, 'get_product_categories' ), WC_API_Server::READABLE ), array( array( $this, 'create_product_category' ), WC_API_Server::CREATABLE | WC_API_Server::ACCEPT_DATA ), ); # GET/PUT/DELETE /products/categories/<id> $routes[ $this->base . '/categories/(?P<id>\d+)' ] = array( array( array( $this, 'get_product_category' ), WC_API_Server::READABLE ), array( array( $this, 'edit_product_category' ), WC_API_Server::EDITABLE | WC_API_Server::ACCEPT_DATA ), array( array( $this, 'delete_product_category' ), WC_API_Server::DELETABLE ), ); # GET/POST /products/tags $routes[ $this->base . '/tags' ] = array( array( array( $this, 'get_product_tags' ), WC_API_Server::READABLE ), array( array( $this, 'create_product_tag' ), WC_API_Server::CREATABLE | WC_API_Server::ACCEPT_DATA ), ); # GET/PUT/DELETE /products/tags/<id> $routes[ $this->base . '/tags/(?P<id>\d+)' ] = array( array( array( $this, 'get_product_tag' ), WC_API_Server::READABLE ), array( array( $this, 'edit_product_tag' ), WC_API_Server::EDITABLE | WC_API_Server::ACCEPT_DATA ), array( array( $this, 'delete_product_tag' ), WC_API_Server::DELETABLE ), ); # GET/POST /products/shipping_classes $routes[ $this->base . '/shipping_classes' ] = array( array( array( $this, 'get_product_shipping_classes' ), WC_API_Server::READABLE ), array( array( $this, 'create_product_shipping_class' ), WC_API_Server::CREATABLE | WC_API_Server::ACCEPT_DATA ), ); # GET/PUT/DELETE /products/shipping_classes/<id> $routes[ $this->base . '/shipping_classes/(?P<id>\d+)' ] = array( array( array( $this, 'get_product_shipping_class' ), WC_API_Server::READABLE ), array( array( $this, 'edit_product_shipping_class' ), WC_API_Server::EDITABLE | WC_API_Server::ACCEPT_DATA ), array( array( $this, 'delete_product_shipping_class' ), WC_API_Server::DELETABLE ), ); # GET/POST /products/attributes $routes[ $this->base . '/attributes' ] = array( array( array( $this, 'get_product_attributes' ), WC_API_Server::READABLE ), array( array( $this, 'create_product_attribute' ), WC_API_Server::CREATABLE | WC_API_Server::ACCEPT_DATA ), ); # GET/PUT/DELETE /products/attributes/<id> $routes[ $this->base . '/attributes/(?P<id>\d+)' ] = array( array( array( $this, 'get_product_attribute' ), WC_API_Server::READABLE ), array( array( $this, 'edit_product_attribute' ), WC_API_Server::EDITABLE | WC_API_Server::ACCEPT_DATA ), array( array( $this, 'delete_product_attribute' ), WC_API_Server::DELETABLE ), ); # GET/POST /products/attributes/<attribute_id>/terms $routes[ $this->base . '/attributes/(?P<attribute_id>\d+)/terms' ] = array( array( array( $this, 'get_product_attribute_terms' ), WC_API_Server::READABLE ), array( array( $this, 'create_product_attribute_term' ), WC_API_Server::CREATABLE | WC_API_Server::ACCEPT_DATA ), ); # GET/PUT/DELETE /products/attributes/<attribute_id>/terms/<id> $routes[ $this->base . '/attributes/(?P<attribute_id>\d+)/terms/(?P<id>\d+)' ] = array( array( array( $this, 'get_product_attribute_term' ), WC_API_Server::READABLE ), array( array( $this, 'edit_product_attribute_term' ), WC_API_Server::EDITABLE | WC_API_Server::ACCEPT_DATA ), array( array( $this, 'delete_product_attribute_term' ), WC_API_Server::DELETABLE ), ); # POST|PUT /products/bulk $routes[ $this->base . '/bulk' ] = array( array( array( $this, 'bulk' ), WC_API_Server::EDITABLE | WC_API_Server::ACCEPT_DATA ), ); return $routes; }