这个用于Bing翻译器API的delphi代码有什么问题?

时间:2014-11-19 09:48:10

标签: delphi bing-translator-api

我使用的是以下delphi代码:

 clHttp1.Request.Header.ContentType := 'application/x-www-form-urlencoded';
 try
    AccountKey:=Account;
    clHttp1.Request.AddFormField('client_id',clientValue);
    clHttp1.Request.AddFormField('client_secret',AccountKey);
    clHttp1.Request.Header.Authorization:='Basic ' + Encode64(AccountKey + ':' + AccountKey);
    clHttp1.Post('https://api.datamarket.azure.com/Bing/MicrosoftTranslator/v1/Translate?Text=%27developer%27&To=%27es%27&From=%27en%27', value);
except
      on e: Exception do
        ShowMessage(e.Message);
end;

始终收到错误“不支持您提供的授权类型。仅支持基本和oauth” 回复

HTTP/1.1 401 The authorization type you provided is not supported.  Only Basic and OAuth are supported
Server: Microsoft-IIS/8.0
X-Content-Type-Options: nosniff
WWW-Authenticate: Basic Realm=""
X-Powered-By: ASP.NET
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: false
Access-Control-Allow-Headers: Authorization, DataServiceVersion, MaxDataServiceVersion
Access-Control-Expose-Headers: DataServiceVersion, MaxDataServiceVersion
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Max-Age: 604800
Date: Wed, 19 Nov 2014 09:40:24 GMT
Content-Length: 91

我做错了什么?

0 个答案:

没有答案