azure - 使用 Microsoft Azure 认知服务 API 收到 401/404 错误

标签 azure api rest azure-cognitive-services

我按照 https://learn.microsoft.com/en-us/rest/api/computervision/3.1/describeimage/describeimage 的指示进行操作但每次我填写端点时,如 https://[resource_name].cognitiveservices.azure.com 或 https://southcentralus.api.cognitive.microsot.com ,我分别收到 404 或 401 错误。我已经检查过,以确保我指定的图像 url 可以正常工作并加载,不会出现 404 错误。任何人都可以提供帮助吗?

最佳答案

您可以使用以下两个主机发送请求:

https://<your service name>.cognitiveservices.azure.com
https://<your service loaction>.api.cognitive.microsoft.com

您可以在 Azure 门户=>认知服务=>您的服务=> key 和端点上找到所有内容:

enter image description here

您应该将 key 作为请求 header :Ocp-Apim-Subscription-Key 以避免 401 错误,如下所示:

enter image description here enter image description here

如果您还有其他问题,请告诉我。

关于azure - 使用 Microsoft Azure 认知服务 API 收到 401/404 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66961394/

相关文章:

python - 为什么 Github API 允许我访问但不列出私有(private)仓库?

api - 用于测试 API 的 cURL 的 GUI 前端

rest - 如何通过 RESTful API 公开有关资源的统计信息?

c# - 如何在 Google Cloud AutoML 中将数据导入数据集并重新训练自定义模型

java - 使用 Java 管理非常长时间的操作

c# - 针对 Azure/CDN 进行编程

azure - 获取c#中存储帐户文件共享中上传的所有文件

typescript - nest.js @Post设置响应的内容类型

azure - SQL Azure 限制 - 索引的影响

c# - Azure EventHub函数触发默认重试机制