Domains and DNS > 3 - Advanced Domains Management > Read the domain AuthInfo

3.3 Read the domain AuthInfo

By using the Aruba WsDomains method GetDomainAuthInfo is possible to retrieve domain authorization code . This code I needed for domain transfer requests.

Parameters
domainFullName
Type: String
Full name of the domain.


    /// WsDomains.GetDomainAuthInfo Method (c# .NET)
    public static string GetDomainAuthInfo(WsDomainsClient client,
            String domainFullName)
    {
        //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
            GetDomainAuthInfoRequest request = 
                new GetDomainAuthInfoRequest();

            request.Body = new InputDomainNameEntity();
            request.Body.DomainFullName = domainFullName;

            // call method GetDomainAuthInfo 
            // obtaining a WsResultOfDomainAuthCodeEntity item
            WsResultOfDomainAuthCodeEntity result = 
                client.GetDomainAuthInfo(request);

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

                DomainAuthCodeEntity item = result.Value;
                stringBuilder.Append("\nDomainAuthCode: ");
                stringBuilder.Append(item.DomainAuthCode);
                stringBuilder.Append("\nDomainID: ");
                stringBuilder.Append(item.DomainID);
                stringBuilder.Append("\nDomainName: ");
                stringBuilder.Append(item.DomainName.DomainFullName);
            }
            else
            {
                throw new ApplicationException(result.ResultMessage);
            }
        }
        catch (Exception ex)
        {
            // re-run the error
            throw new ApplicationException(ex.Message);
        }

        return stringBuilder.ToString();
    }
    
/// WsDomains.GetDomainAuthInfo Method (JAVA)
public static String GetDomainAuthInfo(IWsDomains client,
        String domainFullName) 
    {
    //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
        GetDomainAuthInfoRequest request = new GetDomainAuthInfoRequest();
        request.setBody(new InputDomainNameEntity());
        request.getBody().setDomainFullName(domainFullName);

        // call method GetDomainAuthInfo 
        // obtaining a WsResultOfDomainAuthCodeEntity item
        WsResultOfDomainAuthCodeEntity result = client.getDomainAuthInfo(request);

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

            DomainAuthCodeEntity item = result.getValue();
            stringBuilder.append("\nDomainAuthCode: ");
            stringBuilder.append(item.getDomainAuthCode());
            stringBuilder.append("\nDomainID: ");
            stringBuilder.append(item.getDomainID());
            stringBuilder.append("\nDomainName: ");
            stringBuilder.append(item.getDomainName().getDomainFullName());
        } 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