Phone sales support +39 0575 05077
  Phone technical support +39 0575 0508
 

5.1 Purchase a License

Enqueue the purchase of Plesk licenses and of add-on licenses.
By using the Aruba WsLicense method SetEnqueuePurchasePleskLicense, it is possible to purchase a license by specifying the master license with the related Add-on licenses and the corresponding quantities.
The purchase of the plesk licenses can include a 'basic' license and a series of additional add-ons.
The additional add-ons have a compatibility relation with the basic license: not all the add-ons may be compatible with the provided basic license.
The add-ons have a compatibility relation with the other add-ons: not all the add-ons can be added simultaneously to a basic license, if certain add-ons are present then other add-ons may not be added.

Parameters
licensePleskTypeID
Type: Int32
Int32 type item which represents the ID of the master license to be purchased.
addonPleskLicenses
Type: AddonLicense[]
AddonLicense[] class item which represents the list of the Add-on licenses to be purchased with the corresponding amount.
For more details, see the definition of the AddonLicense item.

Returns
The method returns a WsResult item with information on the result of the call to the method.
//IWsLicense.SetEnqueuePurchasePleskLicense Method (c# .NET)
private static void SetEnqueuePurchasePleskLicense(WsLicenseClient client)
{
    //specify the account login details
    client.ClientCredentials.UserName.UserName = "ARU-0000";
    client.ClientCredentials.UserName.Password = "0123456789";

    try
    {
        //create a new item called addonPleskLicenses
        //containing the Addon licenses to be purchased
        List<AddonLicense> addonPleskLicenses = new List<AddonLicense>();

        //E.g.: LicensePleskTypeAddonID: 9 = Plesk License Language Module
        addonPleskLicenses.Add(new AddonLicense()
            { LicensePleskTypeAddonID=1, Quantity=100 }
            );

        //Basic License ID E.g.: licensePleskTypeID: 6 = Windows Plesk License
        int licensePleskTypeID = 6;

        //call the method SetEnqueuePurchasePleskLicense,
        //obtaining a WsResult item
        var result = client.SetEnqueuePurchasePleskLicense(
            licensePleskTypeID, addonPleskLicenses.ToArray()
            );

        //if the call is not successful, re-run the error indicating the message
        if (result.Success)
            throw new ApplicationException(result.ResultMessage);
    }
    catch (Exception ex)
    {
        //re-run the generic error
        throw new ApplicationException(ex.Message);
    }
}
//IWsLicense.setEnqueuePurchasePleskLicense Method (JAVA)
private static void SetEnqueuePurchasePleskLicense(IWsLicense client)
{   
    //specify the account login details
    ((BindingProvider)client).getRequestContext()
            .put(BindingProvider.USERNAME_PROPERTY, "ARU-0000");	
    ((BindingProvider)client).getRequestContext()
            .put(BindingProvider.PASSWORD_PROPERTY, "0123456789");	

    try
    {
        //create a new item called addonPleskLicenses
        //containing the Addon licenses to be purchased
        ArrayOfAddonLicense addonPleskLicenses = new ArrayOfAddonLicense();
        
        //E.g.: LicensePleskTypeAddonID: 9 = Plesk License Language Module
        AddonLicense addon = new AddonLicense();
        addon.setLicensePleskTypeAddonID(1);
        addon.setQuantity(100);
        addonPleskLicenses.getAddonLicense().add(addon);
        
        //Basic License ID E.g.: licensePleskTypeID: 6 = Windows Plesk License
        int licensePleskTypeID = 6;
        
        //call the method setEnqueuePurchasePleskLicense,
        //obtaining a WsResult item
        WsResult result = client.setEnqueuePurchasePleskLicense(
            licensePleskTypeID, addonPleskLicenses
            );
        
        //the call is not successful, re-run the error indicating the message
        if (result.isSuccess()) 
        {
            throw new Exception(result.getResultMessage());
        }
    }
    catch (Exception ex)
    {
        //re-run the generic error
        System.out.println(ex.getMessage());
    }
}
Version
API: v2.8 URL: https://api.dc1.computing.cloud.it/WsLicense/v2.8/WsLicense.svc?wsdl
See also

Version
API: v2.8 URL: https://api.dc1.computing.cloud.it/WsLicense/v2.8/WsLicense.svc?wsdl