To avoid continually polling the Verity Page endpoint for classification responses, clients can create a webhook to listen for results on a Verity callback URL.
To integrate with Verity, the webhook target server must:
Be able to receive HTTPS POST requests over the internet.
Respond to Verity with an HTTP 2XX status code.
Send responses to Verity within 5 seconds.
Note: No data is required in webhook responses to Verity.
These steps walk through a Verity page classification request with webhook integration.
Table of Contents | ||||
---|---|---|---|---|
|
Step 1 – Expose web service
First, expose your web service, for example:
Code Block | ||
---|---|---|
| ||
https://verity-webhook.domain.com/results |
Step 2 – Create page classification request
Create a Verity page classification request, for example:
Code Block | ||
---|---|---|
| ||
https://verity-api.gumgum.com/page/classify?pageUrl=https%3A%2F%2Ftest.iab12.com%2F1 |
Step 3 – Add callbackUrl parameter with webhook address
Add a callBackUrl parameter with the webhook address to the page request. The webhook URL must support HTTPS and be properly URL-encoded. For example:
Code Block | ||
---|---|---|
| ||
&callBackUrl=https%3A%2F%2Fverity-webhook.domain.com%2Fresults |
Step 4 – Submit GET page classification request
Submit the GET request via curl:
Code Block | ||
---|---|---|
| ||
curl -H 'x-api-key: <YOUR_API_KEY_HERE>’ `https://verity-api.gumgum.com/page/classify?pageUrl=https%3A%2F%2Ftest.iab12.com%2F1&callBackUrl=https%3A%2F%2Fverity-webhook.domain.com%2Fresults` |
Verity issues an HTTP Status Code 202 (ACCEPTED) to indicate that the request has been initiated. The status field in the response JSON within the data payload updates to INITIATED.
Note: Verity response time SLAs are under development.
Step 5 – Verity POSTs response to webhook URL
After successfully processing the request, Verity initiates an HTTPS POST to the webhook URL with the JSON response data.
Step 6 – Webhook target server sends a successful response status code
The webhook target server sends a successful response status code (2XX) within the HTTP connection timeout of 5 seconds.