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:

  1. After calling /uploadFiles, store the extractionId and batchId from the response.

  2. Make a POST request to /getBatchResult with the extractionId and batchId.

  3. If the batch is not yet processed, wait a few seconds and then send the request again.

  4. 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:

  1. Configure your webhook URL and secret in the dashboard.

  2. Set up an HTTP server with an endpoint to listen for POST requests from the Extracta.ai's API.

  3. Validate the incoming requests using the provided signature in the headers to ensure they are from Extracta.ai.

  4. 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