Domains and DNS > 3 - Advanced Domains Management > Enable the domain auto renew

3.7 Enable the domain auto renew

By using the Aruba WsDomains method SetDomainAutoRenew is possible to enable or disable autorenew settings of a dominname owned by the user.

Parameters
domainFullName
Type: String
Full name of the domain.

autoRenew
Type: bool
Set the auto-reniew option .


    /// WsDomains.SetDomainAutoRenew Method (c# .NET)
    public static string SetDomainAutoRenew(WsDomainsClient client,
        String domainFullName, bool autoReniew)
    {
        //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 
            SetDomainAutoRenewRequest request = new SetDomainAutoRenewRequest();
            request.Body = new DomainAutorenew();
            request.Body.DomainName = new InputDomainNameEntity();
            request.Body.DomainName.DomainFullName = domainFullName;
            request.Body.AutoRenew = autoReniew;
               
            // call method SetDomainAutoRenew 
            // obtaining a WsResult item
            WsResult result = client.SetDomainAutoRenew(request);

            //if the call is Success print history values
            if (result.Success)
            {
                // get Value returned from server
                stringBuilder.Append("Operation ends successfully. Result Code:");
                stringBuilder.Append(result.ResultCode);
            }
            else
            {
                throw new ApplicationException(result.ResultMessage);
            }
        }
        catch (Exception ex)
        {
            // re-run the error
            throw new ApplicationException(ex.Message);
        }

        return stringBuilder.ToString();
    }
    
/// WsDomains.SetDomainAutoRenew Method (JAVA)
public static String SetDomainAutoRenew(IWsDomains client,
        String domainFullName, boolean autoReniew) 
    {
    //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 
        SetDomainAutoRenewRequest request = new SetDomainAutoRenewRequest();
        request.setBody(new DomainAutorenew());
        request.getBody().setDomainName(new InputDomainNameEntity());
        request.getBody().getDomainName().setDomainFullName(domainFullName);
        request.getBody().setAutoRenew(autoReniew);

        // call method SetDomainAutoRenew 
        // obtaining a WsResult item
        WsResult result = client.setDomainAutoRenew(request);

        //if the call is Success print history values
        if (result.isSuccess()) {
            // get Value returned from server
            stringBuilder.append("Operation ends successfully. Result Code : ");
            stringBuilder.append(result.getResultCode());
        } 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