この記事の目的
公式ドキュメントにはリファレンスが記載されているが、実行するとき毎回変換する必要があるため、備忘の為、記載する
実行するAPI
実行方法
PowerShell の Invoke-RestMethod を使用して実行する
実行例
$key = "<api key>"
$Resource = "<Resource 名>"
$apiversion = "<REST APIのバージョン>" #2024-02-01
$modelversion = "<modelのバージョン>" #2023-04-15
$url = "https://$Resource.cognitiveservices.azure.com/computervision/retrieval:vectorizeImage?api-version=$apiversion&model-version=$modelversion"
$headers = @{}
$headers["Content-Type"] = "application/json"
$headers["Ocp-Apim-Subscription-Key"] = "$key"
$body = '{
"url": "https://learn.microsoft.com/azure/ai-services/computer-vision/media/quickstarts/presentation.png"
}'
$response = Invoke-RestMethod -Uri $url -Method POST -Headers $headers -Body $body
$response
key などの取得方法はこちらを参照
APIのバージョンはREST APIのリファレンスを参照
Modelのバージョンは以下のドキュメント
The 2024-02-01 API includes a multi-lingual model (model version 2023-04-15) that supports text search in 102 languages.
The original English-only model (version 2022-04-11) is still available, but it cannot be combined with the new model in the same search index.