Provides information on the purchased licenses.
By using the Aruba WsLicense method
GetPurchasedLicenses, it is possible to see the details on the licenses purchased by the user.
Parameters
licenseStatus
Type: LicenseStatusTypes
LicenseStatusTypes item which represents the status of the licenses to be recuperated.
Returns
The method returns an array of PleskLicense[] class items containing details on the licenses purchased by the user with the relevant Addon licenses.
//IWsLicense.GetPurchasedLicenses Method (c# .NET)
private static string GetPurchasedLicenses(WsLicenseClient client)
{
//specify the account login details
client.ClientCredentials.UserName.UserName = "ARU-0000";
client.ClientCredentials.UserName.Password = "0123456789";
//a StringBuilder class item is created
StringBuilder sb = new StringBuilder();
try
{
//call method GetPurchasedLicenses,
//obtaining a WsResultOfArrayOfPleskLicense item
WsResultOfArrayOfPleskLicense result =
client.GetPurchasedLicenses(LicenseStatusTypes.All);
//if the call is not successful, re-run the error indicating the message
if (result.Success)
{
sb.AppendLine("PurchasedLicenses:");
//browse the list of the licenses and print the values
foreach (PleskLicense license in result.Value)
{
sb.AppendLine(String.Format("LicensePleskTypeID: {0}",
license.LicensePleskTypeID));
sb.AppendLine(String.Format("LicenseID: {0}",
license.LicenseID));
sb.AppendLine(String.Format("LicenseCode: {0}",
license.LicenseCode));
sb.AppendLine(String.Format("LicenseDescription: {0}",
license.LicenseDescription));
sb.AppendLine(String.Format("Quantity: {0}",
license.Quantity));
sb.AppendLine(String.Format("LicenseStatus: {0}",
license.LicenseStatus));
//browse the list of the Addon licenses and print the values
foreach (PurchasedAddonLicense addon in license.AddonLicenses)
{
sb.AppendLine(String.Format("... LicenseID: {0}",
addon.LicenseID));
sb.AppendLine(String.Format("... LicenseDescription: {0}",
addon.LicenseDescription));
sb.AppendLine(String.Format("... Quantity: {0}",
addon.Quantity));
}
}
}
else
{
throw new ApplicationException(result.ResultMessage);
}
}
catch (Exception ex)
{
//re-run the generic error
throw new ApplicationException(ex.Message);
}
return sb.ToString();
}
//IWsLicense.getPurchasedLicenses Method (JAVA)
private static String GetPurchasedLicenses(IWsLicense client)
{
//specify the account login details
((BindingProvider)client).getRequestContext()
.put(BindingProvider.USERNAME_PROPERTY, "ARU-0000");
((BindingProvider)client).getRequestContext()
.put(BindingProvider.PASSWORD_PROPERTY, "0123456789");
//a StringBuilder class item is created
StringBuilder sb = new StringBuilder();
try
{
//call method getPurchasedLicenses,
//obtaining a WsResultOfArrayOfPleskLicense item
WsResultOfArrayOfPleskLicense result =
client.getPurchasedLicenses(LicenseStatusTypes.ALL);
//if the call is not successful, re-run the error indicating the message
if (result.isSuccess())
{
sb.append("PurchasedLicenses:");
//browse the list of the licenses and print the values
for (PleskLicense license : result.getValue().getPleskLicense())
{
sb.append(String.format("LicensePleskTypeID: %d \n",
license.getLicensePleskTypeID()));
sb.append(String.format("LicenseID: %d \n",
license.getLicenseID()));
sb.append(String.format("LicenseCode: %s \n",
license.getLicenseCode()));
sb.append(String.format("LicenseDescription: %s \n",
license.getLicenseDescription()));
sb.append(String.format("Quantity: %d \n",
license.getQuantity()));
sb.append(String.format("LicenseStatus: %s \n",
license.getLicenseStatus()));
//browse the list of the Addon licenses and print the values
for (PurchasedAddonLicense addon :
license.getAddonLicenses().getPurchasedAddonLicense())
{
sb.append(String.format("... LicenseID: %d \n",
addon.getLicenseID()));
sb.append(String.format("... LicenseDescription: %s \n",
addon.getLicenseDescription()));
sb.append(String.format("... Quantity: %d \n",
addon.getQuantity()));
}
}
}
else
{
throw new Exception(result.getResultMessage());
}
}
catch (Exception ex)
{
//re-run the generic error
System.out.println(ex.getMessage());
}
return sb.toString();
}
Version
API: v2.8 URL: https://api.dc1.computing.cloud.it/WsLicense/v2.8/WsLicense.svc?wsdl