public DomainStatus CheckDomain(string domain) { var domainStatus = DomainStatus.None; HexonetAPI.Connection connection = new HexonetAPI.Connection(_url, _entity, _username, _password); Dictionary <string, string> command = new Dictionary <string, string>(); command.Add("COMMAND", "CheckDomain"); command.Add("DOMAIN", domain); Response response = connection.Request(command); try { int code = Convert.ToInt32(response.Code); domainStatus = (DomainStatus)code; } catch (Exception ex) { ThrowError(response, ex); } return(domainStatus); }
static void Main(string[] args) { HexonetAPI.Connection connection = new HexonetAPI.Connection(new User("1234", "login", "password")); Command command = new Command(); command.Add("COMMAND", "CheckDomain"); command.Add("DOMAIN", "microsoft.com"); Response response = connection.Request(command); List <string> lst = response.AsList(); foreach (var item in lst) { Console.WriteLine(item); } Console.WriteLine(""); Console.WriteLine(response.Code); Console.WriteLine(response.Description); Console.ReadLine(); }
public ContactHandleStatus AddContact(Contact contact) { var contactStatus = ContactHandleStatus.None; HexonetAPI.Connection connection = new HexonetAPI.Connection(_url, _entity, _username, _password); Dictionary <string, string> command = new Dictionary <string, string>(); command.Add("COMMAND", "AddContact"); command.Add("title", contact.Title); command.Add("firstname", contact.FirstName); command.Add("middlename", contact.MiddleName); command.Add("lastname", contact.LastName); command.Add("organization", contact.Organization); command.Add("street", contact.Street); command.Add("city", contact.City); command.Add("state", contact.State); command.Add("zip", contact.Zip); command.Add("country", contact.Country); command.Add("phone", contact.Phone); command.Add("fax", contact.Fax); command.Add("email", contact.Email); command.Add("new", contact.IsNew ? "1" : "0"); Response response = connection.Request(command); try { int code = Convert.ToInt32(response.Code); contactStatus = (ContactHandleStatus)code; } catch (Exception ex) { ThrowError(response, ex); } return(contactStatus); }