API動作確認(Azure AI Document Intelligence, AI Vision)

以下API接続テスト動作確認

以下API先ずは接続確認。VSCのRestClientにて

Analyze Document: 外部URL指定
Document Models - Analyze Document - REST API (Azure Azure AI Services) | Microsoft Learn


@resource_name = kn
@host_name = rn.cognitiveservices.azure.com
@endpoint = https://rn.cognitiveservices.azure.com
@api_key = xxxxxxx
@api_version = 2023-07-31

@modelId = prebuilt-document

@imageUrl = "https://*******/Test001.pdf"
@contentType = application/json

POST {{endpoint}}/formrecognizer/documentModels/{{modelId}}:analyze?api-version={{api_version}}&stringIndexType=textElements
Host: {{host_name}}
Content-Type: {{contentType}}
Ocp-Apim-Subscription-Key: {{api_key}}

{
  "urlSource": {{imageUrl}}
}

Analyze Document:内部ファイル指定

@resource_name = kn
@host_name = rn.cognitiveservices.azure.com
@endpoint = https://rn.cognitiveservices.azure.com
@api_key = xxxxxxx
@api_version = 2023-07-31

@modelId = prebuilt-document

@filePath = ./Test01.pdf
@contentType = application/octet-stream

POST {{endpoint}}/formrecognizer/documentModels/{{modelId}}:analyze?api-version={{api_version}}&stringIndexType=textElements
Host: {{host_name}}
Content-Type: {{contentType}}
Ocp-Apim-Subscription-Key: {{api_key}}

< {{filePath}}

Get analyze result
Document Models - Get Analyze Result - REST API (Azure Azure AI Services) | Microsoft Learn


@host_name = rn.cognitiveservices.azure.com
@api_key = xxxxxxx
@endpoint = https://rn.cognitiveservices.azure.com
@api_version = 2023-07-31
@modelId = prebuilt-document
@apim-request-id = reqid

GET {{endpoint}}/formrecognizer/documentModels/{{modelId}}/analyzeResults/{{apim-request-id}}?api-version={{api_version}}
Ocp-Apim-Subscription-Key: {{api_key}}


AI Vision / Analyze:URL
同期API

@host_name = rn.cognitiveservices.azure.com
@api_key = xxxxxxx
@endpoint = https://rn.cognitiveservices.azure.com
@api_version = 2023-02-01-preview
@features = read
# Image Format only
@imageUrl = https://*****/test.png
@contentType = application/json

POST {{endpoint}}/computervision/imageanalysis:analyze?api-version={{api_version}}&features={{features}}
Content-Type: {{contentType}}
Ocp-Apim-Subscription-Key: {{api_key}}

{
  "url": "{{imageUrl}}"
}


この記事が気に入ったらサポートをしてみませんか?