Backup > 3 - The Service > Get the server list

3.1 Get the server list

By the method IWsBackup GetBackupAccountServers you can get list of servers added for backup for the specified backup account

Parameter
backupAccountID
Type: int
Account identifier

/// WsBackupClient.GetBackupAccountServers   Method (c# .NET)
public static string GetBackupAccountServers(WsBackupClient client,
    int backupAccountId)
{
    //specify the account login details 
    client.ClientCredentials.UserName.UserName = "ARU-0000";
    client.ClientCredentials.UserName.Password = "0123456789";

    StringBuilder stringBuilder = new StringBuilder();

    try
    {
        // call method GetBackupAccountServers  
        // obtaining a WsResultOfArrayOfBackupServer item
        WsResultOfArrayOfBackupServer result = client.GetBackupAccountServers(backupAccountId);

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

            // get Value returned from server
            BackupServer[] items = result.Value;

            if (items != null)
            {
                foreach (BackupServer item in items)
                {
                    stringBuilder.Append("\nBackupServer detail\n");

                    stringBuilder.Append("\n ID: ");
                    stringBuilder.Append(item.ID);
                    stringBuilder.Append("\n DataCenterID: ");
                    stringBuilder.Append(item.DataCenterID);
                    stringBuilder.Append("\n IPAddress: ");
                    stringBuilder.Append(item.IPAddress);
                    stringBuilder.Append("\n ServerName: ");
                    stringBuilder.Append(item.ServerName);                           
                }
            }
        }
        else
        {
            throw new ApplicationException(result.ResultMessage);
        }
    }
    catch (Exception ex)
    {
        // re-run the error
        throw new ApplicationException(ex.Message);
    }

    return stringBuilder.ToString();
}
/// IWsBackupClient.GetBackupAccountServers   Method (JAVA)
public static String GetBackupAccountServers(WsBackupClient client,
    int backupAccountId)
{
        //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
    {
        // call method GetBackupAccountServers  
        // obtaining a WsResultOfArrayOfBackupServer item
        WsResultOfArrayOfBackupServer result = 
                client.GetBackupAccountServers(backupAccountId);

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

            // get Value returned from server
            BackupServer[] items = result.getValue();

            if (items != null)
            {
                for (BackupServer item : items)
                {
                    stringBuilder.append("\nBackupServer detail\n");

                    stringBuilder.append("\n ID: ");
                    stringBuilder.append(item.getID());
                    stringBuilder.append("\n DataCenterID: ");
                    stringBuilder.append(item.getDataCenterID());
                    stringBuilder.append("\n IPAddress: ");
                    stringBuilder.append(item.getIPAddress());
                    stringBuilder.append("\n ServerName: ");
                    stringBuilder.append(item.getServerName());                           
                }
            }
        }
        else
        {
            throw new Exception(result.getResultMessage());
        }
    }
    catch (Exception ex)
    {
        System.out.println(ex);
    }

    return stringBuilder.toString();
}
Version
API: v2.8 URL:https://api.services.cloud.it/wsBackup/v2.8/WsBackup.svc?wsdl