UPDATE: Look like the adaptors for Form Recognizer 3.0 are now available. More details here: Form Recognizer – Connectors | Microsoft Learn. I’ve posted a quick update here: Azure Logic Apps with Form Recognizer version 3.0 – Bruno Lucas Azure Blog
Form Recognizer Studio allows users to train models to analyze forms and extract fields and text. As of this date, if you try to use that with logic apps, the logic app task “Analyze Custom Form” is not yet updated to use the Version 3.0 Form Recognizer API. The logic app task only works with models created with the FOTT sample labeling tool

There is plenty of documentation explaining how to use Form Recognizer with code but not much for the codeless community. Because this still in preview, and we will probably have an updated version for the “Analyze Custom Form” action, I will just show a quick way to use the new API for now using the “HTTP” action.

To give it a try, Start by login into the Form Recognizer Studio and click “create new” under “Custom model”
The official walkthrough from Microsoft is really well detailed (Quickstart: Form Recognizer Studio – Azure Applied AI Services | Microsoft Docs). Follow that and create a Custom Model

In the end of the walkthrough you will see this:

First check the new API details here: Cognitive Services APIs Reference (microsoft.com)
We will need to first POST the file to (#1) “Analyze Document” . This will return a URL with an ID we will use to retrieve the analysis using a GET call (#2):

Looking into the documentation we can see 2 obvious parameters, the url and the secret key. On my case I’m submitting a PDF, so I’ve changed the Content-Type to “Content-Type”: “application/pdf”

To invoke that using the logic app http task, replace the api domain with the region you use on your Azure Form Recognizer.
https://{Region}.api.cognitive.microsoft.com/formrecognizer/documentModels/{modelId}:analyze?api-version=2022-06-30-preview
If you are on Central US…

It will be:
https://centralus.api.cognitive.microsoft.com/formrecognizer/documentModels/{modelId}:analyze?api-version=2022-06-30-preview
Than add your Model ID:

Now its Ready:
https://centralus.api.cognitive.microsoft.com/formrecognizer/documentModels/
94D9DC7B-2D9D-4664-A578-53335288C2A5:analyze?api-version=2022-06-30-preview

Paste it in the “URI” and select Method “POST”
In the “Body”, add the File Content but use the binary cast method:

To send the file I used the SharePoint Action…

…Case you were wondering where the “File Content” came from.

The task above will return the API ready to be used under the parameter “Operation-location”

All you need to do next is one more http using that value. Just remember the second API uses GET and you still need the access key

Note when you run this second Http, it will succeed but without a delay, it will return status=running

I’ve added a delay between and that solved the problem. Maybe there is a better way to do this or it’s something that will be sorted when the API is finished. For now I just used this approach to demo and share what is there for now.

After the delay, the second call will return a long response. We can use the “Parse Json” task to extract the result

To utilize the output from the second API we can use the “Parse Json” action. Copy the output from the second Http action and paste into the “use sample payload to generate schema”. Once you have the schema generated replace all “integers” for “numbers”

Give it a try and push a form. It should work like this:

Leave a Reply