Response Processing
Reference documentation on processing responses using the Mindee client libraries.
This is reference documentation.
Code samples shown are only examples, and will not work as-is. You'll need to copy-paste and modify according to your requirements.
Looking full code samples?
You can also use the "Ask" button at the top of any page in the documentation.
Requirements
You'll need to have already sent a file or URL as described in the Send a File or URL section.
Overview
Depending on how you've sent the file, there are two ways of obtaining the result.
If you've sent via polling (or polling and webhook) you'll get the response directly in your method call.
If you've sent only via webhook, you'll receive the response on your Web server.
Here we'll go over how you can best process the results.
Load From Webhook
If you're using the webhook pattern, you'll need to use the payload sent to your Web server.
Reading the callback data will vary greatly depending on your HTTP server. This is therefore beyond the scope of this example.
Regardless of how you access the JSON payload sent by the Mindee servers, loading this data is done by using a LocalResponse class.
Once it is loaded you can access the data in exactly the same way as a polling response.
To verify the HMAC signature, you'll need the Signing Secret from the webhook:

Assuming you're able to get the raw HTTP request via the variable request .
Assuming you're able to get the raw HTTP request via the variable request .
Assuming you're able to get the raw HTTP request via the variable request .
Assuming you're able to get the raw HTTP request via the variable $requestBody .
Assuming you have a Web server instance myHttpServer .
Assuming you're able to get the raw HTTP request via the variable request .
The Response Object
This is the base object of the response.
It doesn't do much on its own except allow you to access the Inference object.
The response object can be used to retrieve the raw response from the server, as a JSON string:
The Inference Object
This is the top-level object in the response.
It contains the following attributes:
idUUID of the inferencemodelModel used for the inferencefileMetadata concerning the file used for the inferenceresultResult of inference processing, the most important portion of the response.Fields: For handling the extracted fields, see the Extraction Result section.
Raw Text: For using the extracted text, see the Response Processing section.
File Metadata
You can access various metadata concerning the file sent for processing.
Using the Response object from either the polling response or a webhook payload:
Last updated
Was this helpful?

