public DomainCreateResult Create(DomainCreateRequest domain) { var query = new Query(_params); foreach (var item in GetNamesAndValuesFromProperties(domain)) query.AddParameter(item.Key, item.Value); XDocument doc = query.Execute("namecheap.domains.create"); XElement result = doc.Root.Element(_ns + "CommandResponse").Element(_ns + "DomainCreateResult"); var serializer = new XmlSerializer(typeof(DomainCreateResult), _ns.NamespaceName); using (var reader = result.CreateReader()) { return (DomainCreateResult)serializer.Deserialize(reader); } }
/// <summary> /// Registers a new domain. /// </summary> /// <param name="domain">Information about domain to register.</param> /// <returns>Information about the created domain.</returns> /// <exception cref="ApplicationException"> /// Exception when the following problems are encountered: /// - 2033409 Possibly a logical error at the authentication phase. The order chargeable for the Username is not found /// - 2033407, 2033270 Cannot enable Whoisguard when AddWhoisguard is set to NO /// - 2015182 Contact phone is invalid. The phone number format is +NNN.NNNNNNNNNN /// - 2015267 EUAgreeDelete option should not be set to NO /// - 2011170 Validation error from PromotionCode /// - 2011280 Validation error from TLD /// - 2015167 Validation error from Years /// - 2030280 TLD is not supported in API /// - 2011168 Nameservers are not valid /// - 2011322 Extended Attributes are not valid /// - 2010323 Check the required field for billing domain contacts /// - 2528166 Order creation failed /// - 3019166, 4019166 Domain not available /// - 3031166 Error while getting information from the provider /// - 3028166 Error from Enom ( Errcount <> 0 ) /// - 3031900 Unknown response from the provider /// - 4023271 Error while adding a free PositiveSSL for the domain /// - 3031166 Error while getting a domain status from Enom /// - 4023166 Error while adding a domain /// - 5050900 Unknown error while adding a domain to your account /// - 4026312 Error in refunding funds /// - 5026900 Unknown exceptions error while refunding funds /// - 2515610 Prices do not match /// - 2515623 Domain is premium while considered regular or is regular while considered premium /// - 2005 Country name is not valid /// </exception> public DomainCreateResult Create(DomainCreateRequest domain) { var query = new Query(_params); foreach (var item in GetNamesAndValuesFromProperties(domain)) { query.AddParameter(item.Key, item.Value); } XDocument doc = query.Execute("namecheap.domains.create"); XElement result = doc.Root.Element(_ns + "CommandResponse").Element(_ns + "DomainCreateResult"); var serializer = new XmlSerializer(typeof(DomainCreateResult), _ns.NamespaceName); using (var reader = result.CreateReader()) { return((DomainCreateResult)serializer.Deserialize(reader)); } }