Polling vs Webhook
Polling
Polling is a method where your application will repeatedly make a request to the /getBatchResult
endpoint to check if the batch processing has been completed. This is done by sending requests at regular intervals, using the extractionId
and batchId
received from the /uploadFiles
endpoint.
Instructions for Polling:
After calling
/uploadFiles
, store theextractionId
andbatchId
from the response.Make a
POST
request to/getBatchResult
with theextractionId
andbatchId
.If the batch is not yet processed, wait a few seconds and then send the request again.
Repeat step 3 until you receive a response indicating that the batch status is
finished
.
Webhook
Webhooks provide a way to receive a callback notification to a specified URL endpoint when an event occurs, in this case, when a batch processing is complete. Instead of your application checking in at regular intervals, the API will send a POST request to the endpoint you configured with the results once they are ready.
Instructions for Using Webhook:
Configure your webhook URL and secret in the dashboard.
Set up an HTTP server with an endpoint to listen for POST requests from the Extracta.ai's API.
Validate the incoming requests using the provided signature in the headers to ensure they are from Extracta.ai.
Once validated, process the data sent by the webhook as needed.
Using webhooks is generally more efficient than polling, as it eliminates the need for repeated requests and provides real-time updates as soon as the batch processing is complete. However, setting up a webhook requires you to have a publicly accessible URL and handle the security for verifying incoming requests.
Last updated