generated from AdobeDocs/dev-site-documentation-template
-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tanmay Sharma
authored and
Tanmay Sharma
committed
Jan 12, 2024
1 parent
4fdb090
commit 3eeda4a
Showing
8 changed files
with
461 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
122 changes: 122 additions & 0 deletions
122
src/pages/overview/pdf-services-api/howtos/webhook-notification.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
--- | ||
title: Webhook Notification support for Adobe PDF Services APIs | Adobe PDF Services | ||
--- | ||
# **Webhook Notification Support for Adobe PDF Services APIs** | ||
|
||
Adobe PDF Service APIs now offer support for Webhook notifications. Webhooks are designed to facilitate the receipt of job completion notifications. This new feature eliminates the need for clients to manually invoke the [GET Status API](https://developer.adobe.com/document-services/docs/apis/#tag/Create-PDF/operation/pdfoperations.jobstatus) to obtain job completion status and results. Instead, they will receive automatic notifications containing the job status and result. | ||
|
||
To leverage the power of webhooks, clients are required to include the **notifiers** key in the request body when making a call to the **[Submit Job](https://developer.adobe.com/document-services/docs/apis/#tag/Create-PDF/operation/pdfoperations.createpdf)** API. The **notifiers** key is designed to receive a list of objects, with each object corresponding to a specific webhook. Each notifier object is composed of two essential fields: **type** and **data**. Here, we provide detailed information about these fields and offer a sample request: | ||
|
||
1. **type**: This field specifies the type of notifier to be invoked. Currently, the only supported notifier type is [CALLBACK](#callback-webhook-usage). | ||
2. **data**: This field contains the data required for the webhook. The specific data may vary depending on the type of notifier in use. | ||
|
||
For more information on the **CALLBACK** notifier, please refer to the [Callback Notifier](#callback-webhook-usage) section. | ||
|
||
### Sample Request Body | ||
```json | ||
{ | ||
"assetID": "<ASSET ID>", | ||
...., | ||
///REST API Operation related details | ||
.... | ||
|
||
"notifiers": [ | ||
{ | ||
"type": "<NOTIFIER_TYPE>", | ||
"data": { | ||
//<NOTIFICATION_DATA> | ||
} | ||
} | ||
} | ||
] | ||
} | ||
``` | ||
|
||
## **Callback Webhook Usage** | ||
The callback webhook feature allows the client to receive notifications regarding job completion on an HTTPS URL. To enable this feature, the client is required to create an HTTPS POST URL and share that URL along with the necessary header information in the request. Once the job has been successfully completed, we generate a notification payload that includes information about the job status and the details of the output assets. This payload is then sent via an HTTP POST request to the URL provided by the client. | ||
|
||
### Parameters for the Notifier Object | ||
When utilizing the callback webhook, the following parameters need to be included within the notifier object: | ||
1. **type** _(Required)_: This field should always be set to ***CALLBACK***. | ||
2. **data** _(Required)_: The "data" field contains the following keys: | ||
* ***url*** _(Required)_: This is the HTTPS POST URL created by the user to receive the callback. | ||
* ***headers*** _(Optional)_: This is a map of key-value pairs and represents header-related information required to make the URL call. This field is optional but can be used to provide additional context or authentication for the callback. | ||
|
||
### Sample Notifier Object | ||
|
||
```json | ||
{ | ||
"assetID": "<ASSET ID>", | ||
...., | ||
///REST API Operation related details | ||
.... | ||
|
||
"notifiers": [ | ||
{ | ||
"type": "CALLBACK", | ||
"data": { | ||
"url": "https://dummy.callback.org/", | ||
"headers": { | ||
"x-api-key": "dummykey", | ||
"access-token": "dummytoken" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
``` | ||
|
||
### Callback Payload on HTTPS URL | ||
The notification payload sent to CALLBACK URL is same as that of **GET STATUS** response along with jobID. | ||
|
||
#### In case Job completes with Success | ||
In case of successful job completion, the following **callback payload** will be sent to callback url: | ||
```json | ||
{ | ||
"jobID": "<JOB ID>", | ||
"statusResponse": { | ||
"status": "done", | ||
"asset": { | ||
"metadata": { | ||
"type": "application/pdf", | ||
"size": 318974 | ||
}, | ||
"downloadUri": "<DOWNLOAD URI", | ||
"assetID": "<ASSET ID>" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
#### In case Job completes with Failure | ||
In case of failed job completion, the following **callback payload** will be sent to callback url: | ||
```json | ||
{ | ||
"jobID": "<JOB ID>", | ||
"statusResponse": { | ||
"status": "failed", | ||
"error": { | ||
"code": "<ERROR CODE>", | ||
"message": "<ERROR MESSAGE>", | ||
"status": 400 | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Expected Response from the Client | ||
The client is expected to return the following response payload with an HTTP status code of 200 (OK): | ||
```json | ||
{ | ||
"ack": "done" | ||
} | ||
``` | ||
<InlineAlert slots="text"/> | ||
<div> | ||
If the response code is not 200 (OK) or the expected payload is not received, it will be considered an error response. In the event of 50 error responses within a 10-minute period, webhook notification support will be temporarily blocked for that client for the next 20 minutes. | ||
</div> | ||
|
||
## Limitations | ||
1. Webhook notification support is not available for [external storage](https://developer.adobe.com/document-services/docs/overview/pdf-services-api/howtos/pdf-external-storage-sol/) based APIs. | ||
2. It is not available for [PDFProperties](https://developer.adobe.com/document-services/docs/overview/pdf-services-api/howtos/pdf-properties/) operation. | ||
2. It is currently not available in SDKs (v3.5.0 and below). Future versions of SDK will include the support of notifiers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.