Domains and DNS > 2 - Domains Management > Read the list of purchasable TLD

2.3 Read the list of purchasable TLD

By using the Aruba WsDomains method GetDomainTlds is possible to retrieve the list of TLD (Top Level Domain) which can be purchased by the Customer.

    /// WsDomains.GetDomainTlds Method (c# .NET)
    public static string GetDomainTlds(WsDomainsClient client)
    {
        //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
            WsRequest request = new WsRequest();
                
            // call method GetDomainTlds 
            // obtaining a WsResultOfArrayOfExtendedDomainTldInfoEntity item
            WsResultOfArrayOfExtendedDomainTldInfoEntity result = 
                client.GetDomainTlds(request);

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

                // for each domain print the information
                foreach (ExtendedDomainTldInfoEntity domain in domains)
                {
                    stringBuilder.Append("\n-------------------");
                    stringBuilder.Append("\nAvailavle: ");
                    stringBuilder.Append(domain.Available);

                    stringBuilder.Append("\nAuthCodeRequired  : ");
                    stringBuilder.Append(domain.AuthCodeRequired);
                    stringBuilder.Append("\nWhoIsPrivacy  : ");
                    stringBuilder.Append(domain.WhoIsPrivacy);

                    stringBuilder.Append("\nDnsMaxQuantity  : ");
                    stringBuilder.Append(domain.DnsMaxQuantity);
                    stringBuilder.Append("\nNameMaxLength  : ");
                    stringBuilder.Append(domain.NameMaxLength);
                    stringBuilder.Append("\nNameMinLength  : ");
                    stringBuilder.Append(domain.NameMinLength);

                    if (domain.DnsMaxRegistrationQuantity.HasValue)
                    {
                        stringBuilder.Append("\nDnsMaxRegistrationQuantity  : ");
                        stringBuilder.Append(
                            domain.DnsMaxRegistrationQuantity.Value);
                    }

                    stringBuilder.Append("\nDnsMinQuantity  : ");
                    stringBuilder.Append(domain.DnsMinQuantity);
                    stringBuilder.Append("\nDomainLockStatusAvailable  : ");
                    stringBuilder.Append(domain.DomainLockStatusAvailable);
                    stringBuilder.Append("\nDomainPrivacyAvailable  : ");
                    stringBuilder.Append(domain.DomainPrivacyAvailable);
                        
                    if (domain.GracePeriod.HasValue)
                    {
                        stringBuilder.Append("\nGracePeriod  : ");
                        stringBuilder.Append(domain.GracePeriod.Value);
                    }

                    if (domain.RedemptionPeriod.HasValue)
                    {
                        stringBuilder.Append("\nRedemptionPeriod  : ");
                        stringBuilder.Append(domain.RedemptionPeriod.Value);
                    }

                    stringBuilder.Append("\nRegistrationMinimumPeriod  : ");
                    stringBuilder.Append(domain.RegistrationMinimumPeriod);
                    stringBuilder.Append("\nTldCode  : ");
                    stringBuilder.Append(domain.TldCode);
                    stringBuilder.Append("\nTldID: ");
                    stringBuilder.Append(domain.TldID);

                    if (domain.PricingData != null)
                    {
                        foreach (ResourcePricingEntity item in domain.PricingData)
                        {
                            stringBuilder.Append("\n----- Pricing Data ------\n");
                            stringBuilder.Append("\nProductID : ");
                            stringBuilder.Append(item.ProductID);
                            stringBuilder.Append("\nProductStatus : ");
                            stringBuilder.Append(item.ProductStatus);
                            stringBuilder.Append("\nResourceType : ");
                            stringBuilder.Append(item.ResourceType);
                            stringBuilder.Append("\nCurrencyCode : ");
                            stringBuilder.Append(item.CurrencyCode);
                            stringBuilder.Append("\nPrice : ");
                            stringBuilder.Append(item.Price);
                            stringBuilder.Append("\nPricyingTypes : ");
                            stringBuilder.Append(item.PricyingTypes);
                        }
                    }
                }
            }
            else
            {
                throw new ApplicationException(result.ResultMessage);
            }
        }
        catch (Exception ex)
        {
            // re-run the error
            throw new ApplicationException(ex.Message);
        }

        return stringBuilder.ToString();
    }
    
/// WsDomains.GetDomainTlds Method (JAVA)
public static String GetDomainTlds(IWsDomains client) 
    {
    //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
        WsRequest request = new WsRequest();

        // call method GetDomainTlds 
        // obtaining a WsResultOfArrayOfExtendedDomainTldInfoEntity item
        WsResultOfArrayOfExtendedDomainTldInfoEntity result =
                client.getDomainTlds(request);

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

            // get Value returned from server
            List extendedDomainTldInfoEntityList = result.getValue().
		getExtendedDomainTldInfoEntity();

            for (Iterator<ExtendedDomainTldInfoEntity> it = 
		    extendedDomainTldInfoEntityList.iterator(); it.hasNext();)
                {
                ExtendedDomainTldInfoEntity domain = it.next();
                
                stringBuilder.append("\n-------------------");
                
                stringBuilder.append("\nAuthCodeRequired  : ");
                stringBuilder.append(domain.getAuthCodeRequired());
                stringBuilder.append("\nWhoIsPrivacy  : ");
                stringBuilder.append(domain.getWhoIsPrivacy());

                
                stringBuilder.append("\nDnsMaxRegistrationQuantity  : ");
                stringBuilder.append(domain.getDnsMaxRegistrationQuantity());
                stringBuilder.append("\nDnsMinQuantity  : ");
                stringBuilder.append(domain.getDnsMinQuantity());
                stringBuilder.append("\nDnsMaxQuantity  : ");
                stringBuilder.append(domain.getDnsMaxQuantity());
                
                stringBuilder.append("\nNameMaxLength  : ");
                stringBuilder.append(domain.getNameMaxLength());
                stringBuilder.append("\nNameMinLength  : ");
                stringBuilder.append(domain.getNameMinLength());

                stringBuilder.append("\nRegistrationMinimumPeriod  : ");
                stringBuilder.append(domain.getRegistrationMinimumPeriod());
                stringBuilder.append("\nTldCode  : ");
                stringBuilder.append(domain.getTldCode());
                stringBuilder.append("\nTldID: ");
                stringBuilder.append(domain.getTldID());

                if (domain.getPricingData() != null) 
                    {
                    List resourcePricingEntityList = domain.getPricingData().
                        getResourcePricingEntity();
                    for (Iterator<ResourcePricingEntity> it2 = 
			    resourcePricingEntityList.iterator(); it2.hasNext();)
                        {
                        ResourcePricingEntity item = it2.next();
                        stringBuilder.append("\n----- Pricing Data ------\n");
                        stringBuilder.append("\nProductID : ");
                        stringBuilder.append(item.getProductID());
                        stringBuilder.append("\nProductStatus : ");
                        stringBuilder.append(item.getProductStatus());
                        stringBuilder.append("\nResourceType : ");
                        stringBuilder.append(item.getResourceType());
                        stringBuilder.append("\nCurrencyCode : ");
                        stringBuilder.append(item.getCurrencyCode());
                        stringBuilder.append("\nPrice : ");
                        stringBuilder.append(item.getPrice());
                        stringBuilder.append("\nPricyingTypes : ");
                        stringBuilder.append(item.getPricyingTypes());
                    }
                }
            }
        } else {
            throw new Exception(result.getResultMessage());
        }
    } catch (Exception ex) {
        //show error
        System.out.println(ex);
    }

    return stringBuilder.toString();
}
    /// WsDomains.GetDomainTlds Method (c# .NET)
    public static string GetDomainTlds(WsDomainsClient client)
    {
        //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
            WsRequest request = new WsRequest();
                
            // call method GetDomainTlds 
            // obtaining a WsResultOfArrayOfExtendedDomainTldInfoEntity item
            WsResultOfArrayOfExtendedDomainTldInfoEntity result = 
                client.GetDomainTlds(request);

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

                // for each domain print the information
                foreach (ExtendedDomainTldInfoEntity domain in domains)
                {
                    stringBuilder.Append("\n-------------------");
                    stringBuilder.Append("\nAvailavle: ");
                    stringBuilder.Append(domain.Available);
                    stringBuilder.Append("\nDnsMaxQuantity  : ");
                    stringBuilder.Append(domain.DnsMaxQuantity);

                    if (domain.DnsMaxRegistrationQuantity.HasValue)
                    {
                        stringBuilder.Append("\nDnsMaxRegistrationQuantity  : ");
                        stringBuilder.Append(
                            domain.DnsMaxRegistrationQuantity.Value);
                    }

                    stringBuilder.Append("\nDnsMinQuantity  : ");
                    stringBuilder.Append(domain.DnsMinQuantity);
                    stringBuilder.Append("\nDomainLockStatusAvailable  : ");
                    stringBuilder.Append(domain.DomainLockStatusAvailable);
                    stringBuilder.Append("\nDomainPrivacyAvailable  : ");
                    stringBuilder.Append(domain.DomainPrivacyAvailable);
                        
                    if (domain.GracePeriod.HasValue)
                    {
                        stringBuilder.Append("\nGracePeriod  : ");
                        stringBuilder.Append(domain.GracePeriod.Value);
                    }

                    if (domain.RedemptionPeriod.HasValue)
                    {
                        stringBuilder.Append("\nRedemptionPeriod  : ");
                        stringBuilder.Append(domain.RedemptionPeriod.Value);
                    }

                    stringBuilder.Append("\nRegistrationMinimumPeriod  : ");
                    stringBuilder.Append(domain.RegistrationMinimumPeriod);
                    stringBuilder.Append("\nTldCode  : ");
                    stringBuilder.Append(domain.TldCode);
                    stringBuilder.Append("\nTldID: ");
                    stringBuilder.Append(domain.TldID);

                    if (domain.PricingData != null)
                    {
                        foreach (ResourcePricingEntity item in domain.PricingData)
                        {
                            stringBuilder.Append("\n----- Pricing Data ------\n");
                            stringBuilder.Append("\nProductID : ");
                            stringBuilder.Append(item.ProductID);
                            stringBuilder.Append("\nProductStatus : ");
                            stringBuilder.Append(item.ProductStatus);
                            stringBuilder.Append("\nResourceType : ");
                            stringBuilder.Append(item.ResourceType);
                            stringBuilder.Append("\nCurrencyCode : ");
                            stringBuilder.Append(item.CurrencyCode);
                            stringBuilder.Append("\nPrice : ");
                            stringBuilder.Append(item.Price);
                            stringBuilder.Append("\nPricyingTypes : ");
                            stringBuilder.Append(item.PricyingTypes);
                        }
                    }
                }
            }
            else
            {
                throw new ApplicationException(result.ResultMessage);
            }
        }
        catch (Exception ex)
        {
            // re-run the error
            throw new ApplicationException(ex.Message);
        }

        return stringBuilder.ToString();
    }
    
/// WsDomains.GetDomainTlds Method (JAVA)
public static String GetDomainTlds(IWsDomains client) 
    {
    //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
        WsRequest request = new WsRequest();

        // call method GetDomainTlds 
        // obtaining a WsResultOfArrayOfExtendedDomainTldInfoEntity item
        WsResultOfArrayOfExtendedDomainTldInfoEntity result =
                client.getDomainTlds(request);

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

            // get Value returned from server
            List extendedDomainTldInfoEntityList = result.getValue().
		getExtendedDomainTldInfoEntity();

            for (Iterator<ExtendedDomainTldInfoEntity> it = 
		    extendedDomainTldInfoEntityList.iterator(); it.hasNext();)
                {
                ExtendedDomainTldInfoEntity domain = it.next();
                stringBuilder.append("\n-------------------");
                stringBuilder.append("\nDnsMaxQuantity  : ");
                stringBuilder.append(domain.getDnsMaxQuantity());
                stringBuilder.append("\nDnsMaxRegistrationQuantity  : ");
                stringBuilder.append(domain.getDnsMaxRegistrationQuantity());
                stringBuilder.append("\nDnsMinQuantity  : ");
                stringBuilder.append(domain.getDnsMinQuantity());
                stringBuilder.append("\nRegistrationMinimumPeriod  : ");
                stringBuilder.append(domain.getRegistrationMinimumPeriod());
                stringBuilder.append("\nTldCode  : ");
                stringBuilder.append(domain.getTldCode());
                stringBuilder.append("\nTldID: ");
                stringBuilder.append(domain.getTldID());

                if (domain.getPricingData() != null) 
                    {
                    List resourcePricingEntityList = domain.getPricingData().
                        getResourcePricingEntity();
                    for (Iterator<ResourcePricingEntity> it2 = 
			    resourcePricingEntityList.iterator(); it2.hasNext();)
                        {
                        ResourcePricingEntity item = it2.next();
                        stringBuilder.append("\n----- Pricing Data ------\n");
                        stringBuilder.append("\nProductID : ");
                        stringBuilder.append(item.getProductID());
                        stringBuilder.append("\nProductStatus : ");
                        stringBuilder.append(item.getProductStatus());
                        stringBuilder.append("\nResourceType : ");
                        stringBuilder.append(item.getResourceType());
                        stringBuilder.append("\nCurrencyCode : ");
                        stringBuilder.append(item.getCurrencyCode());
                        stringBuilder.append("\nPrice : ");
                        stringBuilder.append(item.getPrice());
                        stringBuilder.append("\nPricyingTypes : ");
                        stringBuilder.append(item.getPricyingTypes());
                    }
                }
            }
        } 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