What's app id to use Microsoft translation api?

2.2k views Asked by At

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

2

There are 2 answers

0
PartlyCloudy On BEST ANSWER

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]
0
Kelly Altom On

You don't need to put quotes around the word Bearer and the other stuff you added, just the word

Bearer

followed by a space and then the token. No need for anything else.

When you use the appid then the token is part of the query string. If you use Authorization then the token is part of the header.

To try out the method on the doc.microsofttranslator.com site, just put; Bearer and token in the appid.