ericOnline
ericOnline

Reputation: 1967

Logic Apps + Form Recognizer unable to send PDF to service

I have an Azure Logic App that uses a Analyze Document for Prebuilt or Custom models (v3.0 API) action. The Custom Model is good, I can hit it with Postman with no issue.

When I try to get a PDF from Sharepoint and send it to the service, I get an error saying:

{
  "error": {
    "code": "InvalidRequest",
    "message": "Invalid request.",
    "innererror": {
      "code": "InvalidContent",
      "message": "The file is corrupted or format is unsupported. Refer to documentation for the list of supported formats."
    }
  }
}

I've tried:

Why can I not send the file to the Form Recognizer service?

enter image description here


EDIT:

Thank you to @vijaya. They helped me see that the Document/Image URL parameter was not necessary. Leaving that blank and using the original Get File Content worked!

enter image description here

Upvotes: 0

Views: 2682

Answers (1)

vijaya
vijaya

Reputation: 1721

Issue is with content-type. You need to pass content-type along with content for analyze document. I have reproduced issue from my side and below are steps I followed,

  1. Initially created logic app as shown below, enter image description here

  2. Logic app failed with error, The file is corrupted or format is unsupported. Refer to documentation for the list of supported formats. enter image description here

  3. Next modified logic app as shown below, enter image description here

  4. In Compose action setting content as outputs('Get_blob_content_(V2)')?['body']?['$content'] and passing content-type as application/pdf as we are dealing with pdf files. enter image description here

  5. In Analyze Document for Prebuilt or Custom models (v3.0 API) action, using outputs of compose in Document/Image File Content.

enter image description here

  1. Logic app ran successfully as shown below,

enter image description here Output of Analyze Document is as shown below, enter image description here

Upvotes: 1

Related Questions