使用BigCommerce创建Webhook

I am trying to create a webhook in the Bigcommerce platform to one of the External URL.

I am not sure if I am doing it right.

I am using the Following URL to post the parameters :

https://www.radwellnesscenter.com/api/v2/hooks.json

I am getting this error : "The requested resource was not found"

here is the PHP code used :

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt( $ch, CURLOPT_HTTPHEADER, array ('Accept: application/json', 'Content-Length: 0') );               
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);

curl_setopt( $ch, CURLOPT_USERPWD, $username . ":" . $client_token); 
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0 ); 
curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );   

Can you please tell, what is missing here ?

There are two issues:

  1. You're using the legacy API format for the URL, which is why you're getting the "resource not found" error. Instead try using the following URL: https://api.bigcommerce.com/stores/{store_hash}/v2/hooks
  2. You need to use OAuth in order to use the webhooks resource as opposed to the legacy API authentication. You'll need to register a new app with Bigcommerce in order to obtain an OAuth client ID that can be exchanged for an OAuth token during app installation. That token will allow you to send requests to the webhooks endpoints. See the Bigcommerce webhooks documentation for more info.