Search code examples
azureazure-cognitive-servicesmicrosoft-translator

What's app id to use Microsoft translation api?


I want to use microsoft translation api. But there are so many new and old one like below.

How to use Bing Translation API?

I want to use "GET /Translate", and used "Bearer" + " " + access token instead of "appid".

Results is here.

Do I need "" for access token? Either way, it doesn't work. humm I'm using this site below to try. Thanks!

http://docs.microsofttranslator.com/oauth-token.html

http://docs.microsofttranslator.com/text-translate.html#!/default/post_TranslateArray

<html>
<body>
<h1>Argument Exception</h1>
<p>Method: Translate()</p>
<p>Parameter: appId</p>
<p>Message: Invalid appId&#xD;
    Parameter name: appId</p>
<code></code>
<p>message id=1446.V2_Rest.Translate.27848FC7</p>
</body>
</html>

Token

POST

Result


Solution

  • Taken from the documentation of the API:

    REQUIRED. If the Authorization header is used, leave the appid field empty else specify a string containing "Bearer" + " " + access token.

    So for your value for appId, you want to do the following:

    1. Follow the instructions at http://docs.microsofttranslator.com/oauth-token.html to obtain a 10 minute authentication token. For this you need to use the Cognitive Services API key you generate within our azure subscription
    2. The value for appId should be the "Bearer"+[ token you got from step 1]