WC_API_Orders::register_routes()publicWC 2.1

Register the routes for this class

GET|POST /orders GET /orders/count GET|PUT|DELETE /orders/<id> GET /orders/<id>/notes

Method of the class: WC_API_Orders{}

No Hooks.

Return

Array.

Usage

$WC_API_Orders = new WC_API_Orders();
$WC_API_Orders->register_routes( $routes );
$routes(array) (required)
-

Changelog

Since 2.1 Introduced.

WC_API_Orders::register_routes() code WC 8.6.1

public function register_routes( $routes ) {

	# GET|POST /orders
	$routes[ $this->base ] = array(
		array( array( $this, 'get_orders' ),     WC_API_Server::READABLE ),
		array( array( $this, 'create_order' ),   WC_API_Server::CREATABLE | WC_API_Server::ACCEPT_DATA ),
	);

	# GET /orders/count
	$routes[ $this->base . '/count' ] = array(
		array( array( $this, 'get_orders_count' ), WC_API_Server::READABLE ),
	);

	# GET /orders/statuses
	$routes[ $this->base . '/statuses' ] = array(
		array( array( $this, 'get_order_statuses' ), WC_API_Server::READABLE ),
	);

	# GET|PUT|DELETE /orders/<id>
	$routes[ $this->base . '/(?P<id>\d+)' ] = array(
		array( array( $this, 'get_order' ),  WC_API_Server::READABLE ),
		array( array( $this, 'edit_order' ), WC_API_Server::EDITABLE | WC_API_Server::ACCEPT_DATA ),
		array( array( $this, 'delete_order' ), WC_API_Server::DELETABLE ),
	);

	# GET|POST /orders/<id>/notes
	$routes[ $this->base . '/(?P<order_id>\d+)/notes' ] = array(
		array( array( $this, 'get_order_notes' ), WC_API_Server::READABLE ),
		array( array( $this, 'create_order_note' ), WC_API_SERVER::CREATABLE | WC_API_Server::ACCEPT_DATA ),
	);

	# GET|PUT|DELETE /orders/<order_id>/notes/<id>
	$routes[ $this->base . '/(?P<order_id>\d+)/notes/(?P<id>\d+)' ] = array(
		array( array( $this, 'get_order_note' ), WC_API_Server::READABLE ),
		array( array( $this, 'edit_order_note' ), WC_API_SERVER::EDITABLE | WC_API_Server::ACCEPT_DATA ),
		array( array( $this, 'delete_order_note' ), WC_API_SERVER::DELETABLE ),
	);

	# GET|POST /orders/<order_id>/refunds
	$routes[ $this->base . '/(?P<order_id>\d+)/refunds' ] = array(
		array( array( $this, 'get_order_refunds' ), WC_API_Server::READABLE ),
		array( array( $this, 'create_order_refund' ), WC_API_SERVER::CREATABLE | WC_API_Server::ACCEPT_DATA ),
	);

	# GET|PUT|DELETE /orders/<order_id>/refunds/<id>
	$routes[ $this->base . '/(?P<order_id>\d+)/refunds/(?P<id>\d+)' ] = array(
		array( array( $this, 'get_order_refund' ), WC_API_Server::READABLE ),
		array( array( $this, 'edit_order_refund' ), WC_API_SERVER::EDITABLE | WC_API_Server::ACCEPT_DATA ),
		array( array( $this, 'delete_order_refund' ), WC_API_SERVER::DELETABLE ),
	);

	# POST|PUT /orders/bulk
	$routes[ $this->base . '/bulk' ] = array(
		array( array( $this, 'bulk' ), WC_API_Server::EDITABLE | WC_API_Server::ACCEPT_DATA ),
	);

	return $routes;
}