翻译器文本API端点返回404代码,并以消息“找不到资源”作为JSON对象

问题描述 投票:0回答:1

[为Azure服务的文本翻译器创建服务后,尝试使用提供的键之一时,该端点将返回带有404错误代码和消息“找不到资源”的json对象

{
    "error": {
        "code": "404",
        "message": "Resource not found"
    }
}

邮递员使用的参数是:

URL:https://agro.cognitiveservices.azure.com/translate?api-version=3.0&to=ta,en

正文JSON:

{
    [
        "Text" : "Hello World"
    ]
}

带有Ocp-Apim-Subscription-Key标头的参数是注册时作为Azure认知服务的订阅密钥而提供的参数。

注意:使用HTTP POST方法。

[请提出解决问题的解决方案,并感谢您。

以下屏幕快照作为链接共享:enter image description here

azure
1个回答
0
投票

查看Microsoft文档,您的端点似乎无效。参见https://docs.microsoft.com/en-us/azure/cognitive-services/translator/quickstart-translate?pivots=programming-language-javascript

HTTP POST端点:https://api.cognitive.microsofttranslator.com/?api-version=3.0&to=ta,en

    headers: {
      'Ocp-Apim-Subscription-Key': subscriptionKey,
      'Content-type': 'application/json',
      'X-ClientTraceId': uuidv4().toString()
    }

正文:

    body: [{
          'text': 'Hello World!'
    }]
© www.soinside.com 2019 - 2024. All rights reserved.