你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Document Models - Analyze Document
使用文档模型分析文档。
POST {endpoint}/formrecognizer/documentModels/{modelId}:analyze?api-version=2022-08-31
POST {endpoint}/formrecognizer/documentModels/{modelId}:analyze?pages={pages}&locale={locale}&stringIndexType={stringIndexType}&api-version=2022-08-31
URI 参数
名称 | 在 | 必需 | 类型 | 说明 |
---|---|---|---|---|
endpoint
|
path | True |
string |
支持的认知服务终结点 (协议和主机名,例如: https://westus2.api.cognitive.microsoft.com) 。 |
model
|
path | True |
string |
唯一的文档模型名称。 正则表达式模式: |
api-version
|
query | True |
请求的 API 版本。 |
|
locale
|
query |
string |
用于文本识别和文档分析的区域设置提示。 值只能包含语言代码(如“en”、“fr”)或 BCP 47 语言标记(如“en-US”)。 |
|
pages
|
query |
string |
要分析的基于 1 的页码的列表。 例如: “1-3,5,7-9” 正则表达式模式: |
|
string
|
query |
用于计算字符串偏移量和长度的方法。 |
请求头
Media Types: "application/json", "application/octet-stream", "application/pdf", "image/jpeg", "image/png", "image/tiff", "image/bmp", "image/heif"
名称 | 必需 | 类型 | 说明 |
---|---|---|---|
Ocp-Apim-Subscription-Key | True |
string |
请求正文
Media Types: "application/json", "application/octet-stream", "application/pdf", "image/jpeg", "image/png", "image/tiff", "image/bmp", "image/heif"
名称 | 类型 | 说明 |
---|---|---|
base64Source |
string |
要分析的文档的 Base64 编码 |
urlSource |
string |
要分析的文档 URL |
响应
名称 | 类型 | 说明 |
---|---|---|
202 Accepted |
请求已成功排队。 标头 Operation-Location: string |
|
Other Status Codes |
遇到错误。 |
安全性
Ocp-Apim-Subscription-Key
类型:
apiKey
在:
header
示例
Analyze |
Analyze |
AnalyzeDocument_Base64
示例请求
POST {endpoint}/formrecognizer/documentModels/prebuilt-layout:analyze?pages=1-2,4&locale=en-US&stringIndexType=textElements&api-version=2022-08-31
{
"base64Source": ""
}
示例响应
Operation-Location: {endpoint}/formrecognizer/documentModels/prebuilt-layout/analyzeResults/{resultId}?api-version=2022-08-31
AnalyzeDocument_Url
示例请求
POST {endpoint}/formrecognizer/documentModels/customModel:analyze?pages=1-2,4&locale=en-US&stringIndexType=textElements&api-version=2022-08-31
{
"urlSource": "http://host.com/doc.pdf"
}
示例响应
Operation-Location: {endpoint}/formrecognizer/documentModels/customModel/analyzeResults/{resultId}?api-version=2022-08-31
定义
名称 | 说明 |
---|---|
Analyze |
文档分析参数。 |
Api |
API 版本。 |
Error |
错误信息。 |
Error |
错误响应对象。 |
Inner |
详细错误。 |
String |
用于计算字符串偏移量和长度的方法。 |
AnalyzeDocumentRequest
文档分析参数。
名称 | 类型 | 说明 |
---|---|---|
base64Source |
string |
要分析的文档的 Base64 编码 |
urlSource |
string |
要分析的文档 URL |
ApiVersion
API 版本。
名称 | 类型 | 说明 |
---|---|---|
2022-08-31 |
string |
Error
错误信息。
名称 | 类型 | 说明 |
---|---|---|
code |
string |
错误代码。 |
details |
Error[] |
详细错误列表。 |
innererror |
详细错误。 |
|
message |
string |
错误消息。 |
target |
string |
错误的目标。 |
ErrorResponse
错误响应对象。
名称 | 类型 | 说明 |
---|---|---|
error |
错误信息。 |
InnerError
详细错误。
名称 | 类型 | 说明 |
---|---|---|
code |
string |
错误代码。 |
innererror |
详细错误。 |
|
message |
string |
错误消息。 |
StringIndexType
用于计算字符串偏移量和长度的方法。
名称 | 类型 | 说明 |
---|---|---|
textElements |
string |
|
unicodeCodePoint |
string |
|
utf16CodeUnit |
string |