Creating webhook subscription¶
To create a webhook subscription, send a POST
request to https://webhook.api.printdeal.com/webhooks
.
The body needs to contain the following JSON data. For example:
{ "description": "New Subscription for events", "url": "https://ennpjtc2q1cm.x.pipedream.net", "events": [ "order.created" ] }
The response HTTP status code will be 201 if the webhook subscription was successfully created.
If you can no longer create a webhook subscription and receive 500 Internal Server Error
, please contact us using email api@drukwerkdeal.nl.
Event Types¶
The list of event types that you can subscribe to receive real-time updates.
Event Type |
Description |
---|---|
|
This type will notify for order created event |
|
This type will notify when an orderline’s status is updated See Orderline status for more information. |
Example request¶
The following PHP code can be used to create a webhook subscription.
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 URL
with the url you would like to recieve the events data.
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://webhook.api.printdeal.com/webhooks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{
'description': 'Subscription for events',
'url': 'URL',
'events': [
'order.created'
]
}",
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;
}