[英]The remote server returned an error: (400) Bad Request. api.reseller.world
我嘗試使用http://api.reseller.world/#api-Domain-GetInfo獲取域 whois 信息,收到此錯誤:遠程服務器返回錯誤:(400)錯誤請求。
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
string apiAddress = "https://api.reseller.world/v1.4/dms/domain/{0}";
string api = string.Format(apiAddress, domainName);
var request = (HttpWebRequest)WebRequest.Create(api);
request.Headers.Add("Authorization", "Bearer token");
request.Method = HttpMethod.Get.ToString();
request.Accept = "application/json";
request.ContentType = "application/json; charset=UTF-8";
HttpWebResponse response;
try
{
response = (HttpWebResponse)request.GetResponse();
}
catch (WebException we)
{
var resp = we.Response as HttpWebResponse;
return null;
}
我閱讀了您的代碼和 api 文檔,並在您使用的 URL 中找到了不同的
形成somting后看起來像這樣
https://api.reseller.world/v1.4/dms/domain/something.something
和文檔 url
成型后
https://api.reseller.world/v1.4/dms/domain/:something.something
不同的是“:”
但我沒有 api 密鑰來測試這個想法
或者您可能需要設置您請求的UserAgent 屬性。 據我記得,C# 沒有設置這個屬性。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.