Reputation: 461
I try to get domain whois info by using http://api.reseller.world/#api-Domain-GetInfo, got this error: The remote server returned an error: (400) Bad Request.
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;
}
Upvotes: 0
Views: 2105
Reputation:
I read your code and api documention and find a different in the URL you used
that after formating somting look like this
https://api.reseller.world/v1.4/dms/domain/something.something
And documention url
After formating
https://api.reseller.world/v1.4/dms/domain/:something.something
Different is ":"
But I have no api key to test this ideia
Or may be you need to set UserAgent Property of your's request. As far as I can remember, C# does not set this property.
Upvotes: 0