Deleting a webhook

To delete a webhook, send a DELETE request to https://webhook.api.printdeal.com/webhooks/{uuid}.

The response, if successfully deleted, will be a JSON object with the status as Inactive:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
 {
   "uuid": "bb9c54d6-f986-4cb5-a8c2-1116fc4dc911",
   "type": "webhook",
   "status": "Inactive",
   "description": "Subscription for order events",
   "configuration": {
     "url": "https://example.com/events",
     "events": [
         "order.created",
     ]
   },
   "createdAt": "2021-09-09T05:59:10.000Z",
   "updatedAt": "2021-09-09T05:59:10.000Z"
 }

If you can no longer delete your webhook, you will receive a 500 Internal Server Error.

Example request

The following PHP code can be used to delete a webhook. Make sure you replace the values YOUR_USER_ID_HERE and YOUR_SECRET_HERE with the User-ID and secret you received on the API-credentials page.

Make sure to replace UUID with the uuid of the webhook you would like to delete.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://webhook.api.printdeal.com/webhooks/UUID",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "DELETE",
    CURLOPT_HTTPHEADER => array(
        "User-ID: YOUR_USER_ID_HERE",
        "API-Secret: YOUR_SECRET_HERE"
    )
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
    echo "cURL Error #:" . $err;
} else {
    echo $response;
}