Creating webhook subscription (Beta version)¶
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:
1 2 3 4 5 6 7 { "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.support@printdeal.com.
Event Types¶
The list of event types that you can subscribe to receive real-time updates.
Event Type | Description |
---|---|
order.created |
This type will notify for order created event |
orderline.status.updated |
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | <?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; } |