Warning: This method has been deprecated. Webhooks deliveries logs now uses logging system instead.
WC_API_Webhooks::get_webhook_delivery( string $webhook_id, string $id, string|null $fields = null )
Get the delivery log for the given webhook ID and delivery ID
Description Description
Parameters Parameters
- $webhook_id
-
(Required) webhook ID
- $id
-
(Required) delivery log ID
- $fields
-
(Optional) fields to limit response to
Default value: null
Return Return
(array|WP_Error)
Source Source
File: includes/legacy/api/v2/class-wc-api-webhooks.php
public function get_webhook_delivery( $webhook_id, $id, $fields = null ) {
try {
// Validate webhook ID
$webhook_id = $this->validate_request( $webhook_id, 'shop_webhook', 'read' );
if ( is_wp_error( $webhook_id ) ) {
return $webhook_id;
}
$id = absint( $id );
if ( empty( $id ) ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_webhook_delivery_id', __( 'Invalid webhook delivery ID.', 'woocommerce' ), 404 );
}
$webhook = new WC_Webhook( $webhook_id );
$log = 0;
if ( ! $log ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_webhook_delivery_id', __( 'Invalid webhook delivery.', 'woocommerce' ), 400 );
}
return array( 'webhook_delivery' => apply_filters( 'woocommerce_api_webhook_delivery_response', array(), $id, $fields, $log, $webhook_id, $this ) );
} catch ( WC_API_Exception $e ) {
return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
}
}
Changelog Changelog
| Version | Description |
|---|---|
| 3.3.0 | Webhooks deliveries logs now uses logging system. |
| 2.2 | Introduced. |