Reputation: 1967
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:
Get file content
directly to the Document/Image File Content
inputbody('Get_file_content)['$content']
concat('data:application/pdf;base64,',body('Get_file_content')['$content']
base64ToBinary(body('Get_file_content')['$content'])
Why can I not send the file to the Form Recognizer service?
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!
Upvotes: 0
Views: 2682
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,
Initially created logic app as shown below,
Logic app failed with error,
The file is corrupted or format is unsupported. Refer to documentation for the list of supported formats.
Next modified logic app as shown below,
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.
In Analyze Document for Prebuilt or Custom models (v3.0 API) action, using outputs of compose in Document/Image File Content.
Output of Analyze Document is as shown below,
Upvotes: 1