Microsoft Translator API Cognitive Services - What is the correct endpoint?
Asked Answered
D

2

6

The Microsoft Azure portal for TextTranslator provides the following endpoint:

https://api.cognitive.microsoft.com/sts/v1.0

Yet this endpoint returns a 200 for issueToken and 404 for Translate. The samples refer to an endpoint of:

https://api.microsofttranslator.com/v2/http.svc/

The docs being out of date given the translator ending in the datamarket was my initial assumption. However, the doc endpoint returns for the Translate method.

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

Which endpoint is it that we should use?

If supposed to use the api.microsofttranslator.com then what is the api.cognitive.microsoft.com in azure for?

Domitian answered 19/12, 2016 at 16:41 Comment(0)
R
2

For the translator API, you need to first get an auth token (first link), and with this token you can call the Translate api (second link).

You can learn more about the auth step here.

Reliquiae answered 19/12, 2016 at 22:55 Comment(3)
thanks. I see. Weird. Not too sure I trust getting API tokens from one service and then using them with another in general. Seems like a scenario ripe for creating security bugs if used as a general pattern.Domitian
api.cognitive.microsoft.com/sts/v1.0/issueToken is returning 404. The interactive tool at docs.microsofttranslator.com/oauth-token.html is returning "error": "no response from server". Anyone know if Microsoft is performing maintenance or what is going on?Haith
Finally got it to work with a POST and Ocp-Apim-Subscription-Key in the header.Haith
E
3

You can use Microsoft Translator API in 2 ways (see the docs):

Electrochemistry answered 30/3, 2018 at 7:15 Comment(0)
R
2

For the translator API, you need to first get an auth token (first link), and with this token you can call the Translate api (second link).

You can learn more about the auth step here.

Reliquiae answered 19/12, 2016 at 22:55 Comment(3)
thanks. I see. Weird. Not too sure I trust getting API tokens from one service and then using them with another in general. Seems like a scenario ripe for creating security bugs if used as a general pattern.Domitian
api.cognitive.microsoft.com/sts/v1.0/issueToken is returning 404. The interactive tool at docs.microsofttranslator.com/oauth-token.html is returning "error": "no response from server". Anyone know if Microsoft is performing maintenance or what is going on?Haith
Finally got it to work with a POST and Ocp-Apim-Subscription-Key in the header.Haith

© 2022 - 2024 — McMap. All rights reserved.