简体   繁体   English

响应状态:未授权

[英]Response Status: Unauthorized

I would like to test the face Rest interfane from java.我想从 java 测试面 Rest 接口。 The purpose is to se if any faces is found in an jpg image.目的是检查是否在 jpg 图像中找到任何面孔。 The res call I uses for this is../face/v1.0/detect我为此使用的 res 调用是../face/v1.0/detect

I am setting the Ocp-Apim-Subscription-Key header to XXXX (edit: hidden by moderation)我将 Ocp-Apim-Subscription-Key header 设置为 XXXX(编辑:通过审核隐藏)

But the answer is Response Status: Unauthorized但答案是响应状态:未授权

Where do I find the correct Ocp-Apim-Subscription-Key header in the påortal?在门户中哪里可以找到正确的 Ocp-Apim-Subscription-Key header?

/Peter /彼得

Prenumerations-ID d97c5756-0c7b-48bf-b511-620078498063 Katalog Default Directory (peterivarsson......onmicrosoft.com) Prenumerations-ID d97c5756-0c7b-48bf-b511-620078498063 目录默认目录 (peterivarsson......onmicrosoft.com)

If you correctly set your "Ocp-Api-Subscription-Key" and you got a 401 Unauthorized reply, it is probably because your endpoint is not correct.如果您正确设置了“Ocp-Api-Subscription-Key”并收到 401 Unauthorized 回复,可能是因为您的端点不正确。

Generally, it's the case when people use a wrong region for their endpoint: each subscription key is linked to a region, it's not global.通常,当人们为其端点使用错误的区域时会出现这种情况:每个订阅密钥都链接到一个区域,它不是全局的。

Or double check the value of your key in your Azure resource if the endpoint is correct.或者,如果端点正确,请仔细检查 Azure 资源中的密钥值。

If you are unsure of your code implementation, use the console tester in the API documentation by taking a simple GET method: choose the correct region in it, just paste your key and there you go https://westeurope.dev.cognitive.microsoft.com/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395248如果您不确定您的代码实现,请通过简单的 GET 方法使用 API 文档中的控制台测试器:在其中选择正确的区域,只需将您的密钥粘贴到go Z5E056C500A1C4B6A7110. .com/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395248

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM