微软Bing翻译API的使用

订阅翻译服务

https://datamarket.azure.com/dataset/bing/microsofttranslator




注册自己的注册应用程序

https://datamarket.azure.com/developer/applications



  • POST
    Content-Type: application/x-www-form-urlencoded
    https://datamarket.accesscontrol.windows.net/v2/OAuth2-13
    grant_type=client_credentials&client_id=active_gaowei&client_secret=secretsecretsecretsecret&scope=http://api.microsofttranslator.com

    {
      "token_type": "http://schemas.xmlsoap.org/ws/2009/11/swt-token-profile-1.0",
      "access_token": "http%3a%2f%2fschemas.xmlsoap.org%2fws%2f2005%2f05%2fidentity%2fclaims%2fnameidentifier=active_gaowei&http%3a%2f%2fschemas.microsoft.com%2faccesscontrolservice%2f2010%2f07%2fclaims%2fidentityprovider=https%3a%2f%2fdatamarket.accesscontrol.windows.net%2f&Audience=http%3a%2f%2fapi.microsofttranslator.com&ExpiresOn=1437443770&Issuer=https%3a%2f%2fdatamarket.accesscontrol.windows.net%2f&HMACSHA256=j69yYSrpz%2bB%2fbLUUSaGAjrxvZxLijAJMGDDm1fRJuog%3d",
      "expires_in": "600",
      "scope": "http://api.microsofttranslator.com"
    }

    注意获得的token密匙是有有效时间的,为600秒即10分钟。 超过10分钟后密匙失效。


  • GET
    Authorization: Bearer http%3a%2f%2fschemas.xmlsoap.org%2fws%2f2005%2f05%2fidentity%2fclaims%2fnameidentifier=active_gaowei&http%3a%2f%2fschemas.microsoft.com%2faccesscontrolservice%2f2010%2f07%2fclaims%2fidentityprovider=https%3a%2f%2fdatamarket.accesscontrol.windows.net%2f&Audience=http%3a%2f%2fapi.microsofttranslator.com&ExpiresOn=1437443770&Issuer=https%3a%2f%2fdatamarket.accesscontrol.windows.net%2f&HMACSHA256=j69yYSrpz%2bB%2fbLUUSaGAjrxvZxLijAJMGDDm1fRJuog%3d
    http://api.microsofttranslator.com/v2/Http.svc/Translate?text=monday&from=en&to=zh

    <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">星期一</string>

其他翻译API :

http://apistore.baidu.com/astore/classificationservicelist/38.html

展开阅读全文

没有更多推荐了,返回首页