咨询Form Recognizer中AnalyzeWithCustomModel接口的请求体格式
Got it, let's break down the request body options for the AnalyzeWithCustomModel API—since you already have a trained model and can make valid calls via Postman, this should map directly to your workflow.
There are two primary supported request body formats, depending on how you want to submit your document:
1. Direct Binary Document Upload
This is the most common approach if you're submitting a local file (like from your machine) via Postman.
- Request Header Requirement: Set the
Content-Typeheader to match your document's format. Supported values include:application/pdffor PDF filesimage/jpegfor JPG imagesimage/pngfor PNG imagesimage/bmpfor BMP imagesimage/tifffor TIFF images
- Request Body: The raw binary content of your document. In Postman, you'd select the
Bodytab, choosebinary, then upload your file directly.
2. Document URL Reference
If your document is hosted at a publicly accessible URL (or an Azure Storage URL with a SAS token), you can submit a JSON payload pointing to that location instead.
- Request Header Requirement: Set the
Content-Typeheader toapplication/json - Request Body Format: A JSON object with a single required field:
{ "sourceUrl": "https://your-hosted-document-location.com/document.pdf" } - Notes: The URL must be publicly accessible (no local network URLs). If using Azure Blob Storage, append a valid SAS token to the URL to grant temporary access.
Optional Additional Field
You can include the includeTextDetails boolean field in the JSON payload (for URL submissions) to get granular text extraction details alongside form results:
{ "sourceUrl": "https://example.com/your-form.pdf", "includeTextDetails": true }
Key Notes to Remember
- Supported document sizes: Up to 50MB (check the latest API version for any updates)
- Multi-page PDFs and multi-page TIFFs are supported, but ensure your model was trained on similar document structures
- Always confirm your trained model ID is correctly included in the API endpoint path (e.g.,
https://<your-resource-region>.cognitiveservices.azure.com/formrecognizer/v2.1/custom/models/<your-model-id>/analyze)
内容的提问来源于stack exchange,提问作者SonOfNye

