S3 Backup API

CloudBerry Lab has started implemeting CloudBerry Backup C# API in addition to the existing command line interface to help other vendors integrate CloudBerry Backup with their products and the customers to integrate CloudBerry Backup with other internal routines.

We are going to extend the C# API gradually based on the customer demand and the first functions exposed thru the API is backup plans statistics

View backup plan details and get plan statistics

Example, that list successful and failed plans:

foreach (BackupPlan plan in BackupProvider.GetBackupPlans())

{

if (plan.Status.LastRunResult == EnumLastRunResult.Success)

{

      Console.WriteLine( "Plan '{0}' has competed successfully. Transferred data size: {1} bytes" , plan.Name, plan.Status.DataSize);

}

else if(plan.Status.LastRunResult == EnumLastRunResult.Failed)

{

      Console.WriteLine("Plan '{0}' failed", plan.Name);

}

}

Start/Stop/Pause plans using API

BackupPlan object lets start, stop, and pause backup plan.

You can use methods:

public void Start();

public void Stop();

public void Pause();

This example starts all plans, that are not currently running:

foreach (BackupPlan plan in BackupProvider.GetBackupPlans())

{

if (plan.Status.IsRunning)

{

plan.Start();

Console.WriteLine( "Plan '{0}' started" , plan.Name);

}

}

How to get started with CloudBerry C# API project

First of all you should add the reference to CloudBerry.Backup.API.dll, it is located in

C:\Program Files\CloudBerryLab\CloudBerry Online Backup

or

C:\Program Files\CloudBerryLab\Windows Home Server (if you are using Windows Home Server version):

add reference

BackupProvider is a root static class, which is used for accessing CloudBerry Backup objects.

It has a method for listing current user backup plans:

public static BackupPlan[] GetBackupPlans()

And events for monitoring backup plans changes:

/// Occurs if plan was changed, removed or created

public static event EventHandler<ChangedEventArgs> PlanChanged;

/// Occurs if plan was removed

public static event EventHandler<PlanRemoveEventArgs> PlanRemoved;

 

BackupPlan has some properties with plan information and Status property for getting plan current/last status. There is also a StatusChanged event which is fired on Status parameters changes.

XML documentation is included, you can use IntelliSense for viewing help:

Test App

Here you can download the source code of the test application that will help you get started with C# API

BackupApiTest.zip (3.4 KB)

Please, check out our featured products: