Click or drag to resize

IWsDomainsGetIsAvailableDomainName Method

The aim of method is 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.

Namespace:  Aruba.Cloud.Domains.WsDomains
Assembly:  Aruba.Cloud.Domains.WsDomains (in Aruba.Cloud.Domains.WsDomains.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
[OperationContractAttribute]
WsResult<List<DomainAvailabilityEntity>> GetIsAvailableDomainName(
	GetIsAvailableDomainRequest request
)

Parameters

request
Type: Aruba.Cloud.Domains.Common.Entities.WcfGetIsAvailableDomainRequest
A GetIsAvailableDomainRequest object

Return Value

Type: WsResultListDomainAvailabilityEntity
Examples
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.
/// 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();
}
See Also