Domains and DNS > 2 - Domains Management > Read purchased domains

2.1 Read purchased domains

By using the Aruba WsDomains method GetAllDomains is possible to retrieve all active domains owned by the authenticated user..


    /// WsDomains.GetAllDomains Method (c# .NET)
    public static string GetAllDomains(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 GetAllDomains 
            // obtaining a WsResultOfArrayOfRegisteredDomainDataEntity item
            WsResultOfArrayOfRegisteredDomainDataEntity result = 
                client.GetAllDomains(request);

            // if the call is Success print returned values
            if (result.Success)
            {                    
                stringBuilder.Append("Operation ends successfully\n");

                // get Value returned from server
                RegisteredDomainDataEntity[] domains = result.Value;

                // for each domain print the information
                foreach (RegisteredDomainDataEntity domain in domains)
                {
                    stringBuilder.Append("\n-------------------");
                    stringBuilder.Append("\nDomain UserID: ");
                    stringBuilder.Append(domain.UserID);
                    stringBuilder.Append("\nDomain CompanyID: ");
                    stringBuilder.Append(domain.CompanyID);
                    stringBuilder.Append("\nDomain DataCenterID: ");
                    stringBuilder.Append(domain.DataCenterID);

                    stringBuilder.Append("\nDomain FullName: ");
                    stringBuilder.Append(domain.DomainName.DomainFullName);
                    if (domain.DomainName.PreferredLanguage.HasValue)
                    {
                        stringBuilder.Append("\nDomain PreferredLanguage: ");
                        stringBuilder.Append(domain.DomainName.PreferredLanguage.Value);
                    }

                    stringBuilder.Append("\nDomain SecondLevelDomain: ");

                    stringBuilder.Append("\nDomain DomainServiceID: ");
                    stringBuilder.Append(domain.DomainServiceID);
                    if (domain.CreationDate.HasValue)
                    {
                        stringBuilder.Append("\nDomain CreationDate: ");
                        stringBuilder.Append(
                            domain.CreationDate.Value.ToLongDateString());
                    }
                    if (domain.ExpiryDate.HasValue)
                    {
                        stringBuilder.Append("\nDomain ExpiryDate: ");
                        stringBuilder.Append(
                            domain.ExpiryDate.Value.ToLongDateString());
                    }
                    stringBuilder.Append("\nDomain AutoRenew: ");
                    stringBuilder.Append(domain.AutoRenew);
                    if (domain.CloudExpiryDate.HasValue)
                    {
                        stringBuilder.Append("\nDomain CloudExpiryDate: ");
                        stringBuilder.Append(d
                        omain.CloudExpiryDate.Value.ToLongDateString());
                    }
                    if (domain.LastRenewDate.HasValue)
                    {
                        stringBuilder.Append("\nDomain LastRenewDate: ");
                        stringBuilder.Append(
                            domain.LastRenewDate.Value.ToLongDateString());
                    }
                    stringBuilder.Append("\nDomain PrivacyStatus: ");
                    stringBuilder.Append(domain.PrivacyStatus);
                    stringBuilder.Append("\nDomain Status: ");
                    stringBuilder.Append(domain.Status);

                }
            }
            else
            {
                throw new ApplicationException(result.ResultMessage);
            }
        }
        catch (Exception ex)
        {
            // re-run the error
            throw new ApplicationException(ex.Message);
        }

        return stringBuilder.ToString();
    }
    
/// WsDomains.GetAllDomains Method (JAVA)
public static String GetAllDomains(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 GetAllDomains 
        // obtaining a WsResultOfArrayOfRegisteredDomainDataEntity item
        WsResultOfArrayOfRegisteredDomainDataEntity result =
                client.getAllDomains(request);

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

            // get Value returned from server
            ArrayOfRegisteredDomainDataEntity arrayOfRegisteredDomainDataEntity = 
		result.getValue();

            // for each domain print the information
            List registeredDomainDataEntityList = 
		arrayOfRegisteredDomainDataEntity.getRegisteredDomainDataEntity();
            for (Iterator<RegisteredDomainDataEntity> 
		it = registeredDomainDataEntityList.iterator(); it.hasNext();)
                {
                RegisteredDomainDataEntity domain = it.next();
                stringBuilder.append("\n-------------------");
                stringBuilder.append("\nDomain UserID: ");
                stringBuilder.append(domain.getUserID());
                stringBuilder.append("\nDomain CompanyID: ");
                stringBuilder.append(domain.getCompanyID());
                stringBuilder.append("\nDomain DataCenterID: ");
                stringBuilder.append(domain.getDataCenterID());

                stringBuilder.append("\nDomain FullName: ");
                stringBuilder.append(domain.getDomainName().getDomainFullName());
                stringBuilder.append("\nDomain PreferredLanguage: ");
                stringBuilder.append(domain.getDomainName().getPreferredLanguage());

                stringBuilder.append("\nDomain SecondLevelDomain: ");

                stringBuilder.append("\nDomain DomainServiceID: ");
                stringBuilder.append(domain.getDomainServiceID());
                stringBuilder.append("\nDomain PrivacyStatus: ");
                stringBuilder.append(domain.getPrivacyStatus());
                stringBuilder.append("\nDomain Status: ");
                stringBuilder.append(domain.getStatus());

            }
        } 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