WC_REST_Webhook_Deliveries_V1_Controller::get_item()
Get a single webhook delivery.
Method of the class: WC_REST_Webhook_Deliveries_V1_Controller{}
No Hooks.
Return
WP_Error|WP_REST_Response
.
Usage
$WC_REST_Webhook_Deliveries_V1_Controller = new WC_REST_Webhook_Deliveries_V1_Controller(); $WC_REST_Webhook_Deliveries_V1_Controller->get_item( $request );
- $request(WP_REST_Request) (required)
- Full details about the request.
WC_REST_Webhook_Deliveries_V1_Controller::get_item() WC REST Webhook Deliveries V1 Controller::get item code WC 9.7.1
public function get_item( $request ) { $id = (int) $request['id']; $webhook = wc_get_webhook( (int) $request['webhook_id'] ); if ( empty( $webhook ) || is_null( $webhook ) ) { return new WP_Error( 'woocommerce_rest_webhook_invalid_id', __( 'Invalid webhook ID.', 'woocommerce' ), array( 'status' => 404 ) ); } $log = array(); if ( empty( $id ) || empty( $log ) ) { return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), array( 'status' => 404 ) ); } $delivery = $this->prepare_item_for_response( (object) $log, $request ); $response = rest_ensure_response( $delivery ); return $response; }