Domains and DNS > 2 - Domains Management > Check domain availability

2.4 Check domain availability

By using the Aruba WsDomains method GetIsAvailableDomainName is possible to check if a domain name is available and can be purchased. It also checks whether the domain name is available for other sold TLDs, and it returns a list of suggested domains names that are related to the specified name.

Parameters
domainFullName
Type: String
Full name of the domain.

preferredLanguage
Type: PreferredLanguages
Enum with the value of preferred language.


     /// WsDomains.GetIsAvailableDomainName Method (c# .NET)
    public static string GetIsAvailableDomainName(WsDomainsClient client, 
    String domainFullName, PreferredLanguages preferredLanguage)
    {
        //specify the account login details 
        client.ClientCredentials.UserName.UserName = "ARU-0000";
        client.ClientCredentials.UserName.Password = "0123456789";

        StringBuilder stringBuilder = new StringBuilder();

        try
        {
            // create the request object
            GetIsAvailableDomainRequest request = new GetIsAvailableDomainRequest();                
            request.Body = new InputDomainNameEntity();
            request.Body.DomainFullName = domainFullName;
            request.Body.PreferredLanguage = preferredLanguage;
                
            // call method GetIsAvailableDomainName 
            // obtaining a WsResultOfArrayOfDomainAvailabilityEntity item
            WsResultOfArrayOfDomainAvailabilityEntity result = 
                client.GetIsAvailableDomainName(request);

            //if the call is Success print history values
            if (result.Success)
            {
                // get Value returned from server
                stringBuilder.Append("Operation ends successfully\n");
                DomainAvailabilityEntity[] items = result.Value;

                foreach (DomainAvailabilityEntity item in items)
                {
                    stringBuilder.Append("\n Domain Full Name: ");
                    stringBuilder.Append(item.DomainName.DomainFullName);
                    stringBuilder.Append("\n IsAvailable: ");
                    stringBuilder.Append(item.IsAvailable);
                }                    
            }
            else
            {
                throw new ApplicationException(result.ResultMessage);
            }
        }
        catch (Exception ex)
        {
            // re-run the error
            throw new ApplicationException(ex.Message);
        }

        return stringBuilder.ToString();
    }
    
/// WsDomains.GetIsAvailableDomainName Method (JAVA)
public static String GetIsAvailableDomainName(IWsDomains client,
        String domainFullName, PreferredLanguages preferredLanguage) 
    {
    //specify the account login details 
    ((BindingProvider) client).getRequestContext()
            .put(BindingProvider.USERNAME_PROPERTY, "ARU-0000");
    ((BindingProvider) client).getRequestContext()
            .put(BindingProvider.PASSWORD_PROPERTY, "0123456789");

    StringBuilder stringBuilder = new StringBuilder();

    try {
        // create the request object
        GetIsAvailableDomainRequest request = new GetIsAvailableDomainRequest();
        request.setBody(new InputDomainNameEntity());
        request.getBody().setDomainFullName(domainFullName);
        request.getBody().setPreferredLanguage(preferredLanguage);

        // call method GetIsAvailableDomainName 
        // obtaining a WsResultOfArrayOfDomainAvailabilityEntity item
        WsResultOfArrayOfDomainAvailabilityEntity result = 
	    client.getIsAvailableDomainName(request);

        //if the call is Success print history values
        if (result.isSuccess()) {
            // get Value returned from server
            stringBuilder.append("Operation ends successfully\n");
            List domainAvailabilityEntityList = result.getValue().
		getDomainAvailabilityEntity();

            for (Iterator<DomainAvailabilityEntity> it = 
		domainAvailabilityEntityList.iterator(); it.hasNext();)
                {
                DomainAvailabilityEntity item = it.next();
                stringBuilder.append("\n Domain Full Name: ");
                stringBuilder.append(item.getDomainName().getDomainFullName());
                stringBuilder.append("\n IsAvailable: ");
                stringBuilder.append(item.isIsAvailable());
                }
        } else {
            throw new Exception(result.getResultMessage());
        }
    } catch (Exception ex) {
        //show error
        System.out.println(ex);
    }

    return stringBuilder.toString();
}
Version
API: v2.8 URL:https://api.services.cloud.it/wsDomains/v2.8/WsDomains.svc?wsdl
See also