来自旧官方网站的信息(翻译
speech和
text api)&
Announcements说,“MICROSOFT TRANSLATOR API现在可以在AZURE门户网站上使用”和“2017年4月30日之前需要采取的行动 – 微软翻译器迁移到Azure”.因此,如果您现在要使用转换程序API,则需要拥有Azure订阅并创建Azure Cognitive服务的转换程序帐户,如官方
tutorial所述.
例如,使用Translator Text API,您可以按照新的tutorial获取访问令牌,为API构建appid,就像下面的Java中的示例代码一样.
// Get the access token
// The key got from Azure portal, please see https://docs.microsoft.com/en-us/azure/cognitive-services/cognitive-services-apis-create-account
String key = "";
String authenticationUrl = "https://api.cognitive.microsoft.com/sts/v1.0/issueToken";
HttpsURLConnection authConn = (HttpsURLConnection) new URL(authenticationUrl).openConnection();
authConn.setRequestMethod("POST");
authConn.setDoOutput(true);
authConn.setRequestProperty("Ocp-Apim-Subscription-Key", key);
IOUtils.write(