Lastline Backup API

The Lastline Backup API is accessible at

The Lastline Backup API is a web-based API to configure and run the backup system on a Lastline Enterprise on-premise installation.

Methods

Method Index

Method Documentation

backup.list_storages(response_format)

List available storages configured in the system

URL

/papi/backup/storage/list[. response_format]

response_format can be xml or json (defaults to json)

HTTP METHOD

GET, POST

Contents of successful response

List of dictionaries; each dictionary describes a storage;

Content of the dictionary depends on the type of storage (ssh, s3)

Dictionary for a storage “ssh” contains:

  • storage_name:

    Name of the storage

  • type:

    Human-readable type of storage (“ssh”)

  • username:

    Username used for the ssh connection

  • server_name:

    Name or IP of the ssh server

  • ssh_port:

    Port used for the ssh connection

  • ssh_id:

    Name of the ssh id used for the ssh connection

  • storage_base:

    Full path to the directory where the backup are stored

  • storage_id:

    Unique identifier of the storage

  • ssh_id_id:

    Unique identifier of the ssh id

Dictionary for a storage “s3” contains:

  • storage_name:

    Name of the storage

  • type:

    Human-readable type of storage (“s3”)

  • aws_key_id:

    Identifier used to connect to Amazon AWS services

  • aws_secret_key:

    Secret key used to connect to Amazon AWS services

  • bucket_name:

    Name of the bucket where the backup are store

  • file_size:

    Maximum size of the files stored on the s3 storage Larger files are splited in several archives

  • storage_id:

    Unique identifier of the storage

backup.add_storage_ssh(response_format)

Add a new SSH storage

URL

/papi/backup/storage/ssh/add[. response_format]

response_format can be xml or json (defaults to json)

HTTP METHOD

POST

POST Parameters

  • storage_name:

    Name of storage to add

  • server_name:

    Name or IP of the ssh server

  • ssh_port:

    Port to use for the ssh connection

  • ssh_username:

    Username to use for the ssh connection

  • ssh_id_id:

    Unique identifier of the ssh id to use for the connection

  • storage_base:

    Full path to the directory where the backup have to be stored

Contents of successful response

“success”
backup.edit_storage_ssh(response_format)

Edit an existing ssh storage

URL

/papi/backup/storage/ssh/edit[. response_format]

response_format can be xml or json (defaults to json)

HTTP METHOD

POST

POST Parameters

All POST parameters defined for the function add_storage_ssh, extended by:

  • storage_id:

    Unique identifier of the storage to edit

Contents of successful response

“success”
backup.add_storage_s3(response_format)

Add a new amazon s3 storage

URL

/papi/backup/storage/s3/add[. response_format]

response_format can be xml or json (defaults to json)

HTTP METHOD

POST

POST Parameters

  • storage_name:

    Name of storage to add

  • aws_key_id:

    Identifier to use for the connection to Amazon AWS services

  • aws_secret_key:

    Secret key to use for the connection to Amazon AWS services

  • file_size:

    Maximum size of the files stored on the s3 storage Larger files are splited in several archives

  • bucket_name:

    Name of the bucket where the backup have to be stored

Contents of successful response

“success”
backup.edit_storage_s3(response_format)

Edit an existing amazon s3 storage

URL

/papi/backup/storage/s3/edit[. response_format]

response_format can be xml or json (defaults to json)

HTTP METHOD

POST

POST Parameters

All POST parameters defined for the function add_storage_s3, extended by:

  • storage_id:

    Unique identifier of the storage to edit

Contents of successful response

“success”
backup.delete_storage(response_format)

Delete an existing storage

URL

/papi/backup/storage/del[. response_format]

response_format can be xml or json (defaults to json)

HTTP METHOD

POST

POST Parameters

  • storage_id:

    Unique identifier of the storage to delete

Contents of successful response

“success”
backup.test_storage(response_format)

Test the configuration of an existing storage

URL

/papi/backup/storage/test[. response_format]

response_format can be xml or json (defaults to json)

HTTP METHOD

GET, POST

GET, POST Parameters

  • storage_name:

    Name of the storage to test

Contents of successful response

“success”
backup.list_jobs(response_format)

List all backup jobs that have been executed on the system

URL

/papi/backup/job/list[. response_format]

response_format can be xml or json (defaults to json)

HTTP METHOD

GET, POST

Contents of successful response

List of dictionaries; each dictionary describes a job and contains:

  • job_status:

    Human-readable status of the job (‘waiting’, ‘running’, ‘success’ or ‘failed’)

  • description:

    A description of the current status (set only when a job is terminated)

  • backup_name:

    Name of the backup associated with this job

  • backup_type:

    Type of backup (‘full’, ‘inc’)

  • start_date:

    Human-readable date in the local timezone when the job was added

  • end_date:

    Human-readable date in the local timezone when the job was finished (in success or failure)

  • job_type:

    Human-readable type of job (‘backup’, ‘restore’)

  • job_id:

    Unique identifier of the job

  • size_transferred:

    Size transferred during the operation (remains to 0 until the operation is completed)

  • size_transferred_human:

    Human-readable version of the size transferred during the operation

backup.run_backup(response_format)

Execute a backup

URL

/papi/backup/backup/run[. response_format]

response_format can be xml or json (defaults to json)

HTTP METHOD

POST

POST Parameters

  • backup_name:

    Name of the backup to execute

  • backup_type:

    Human-readable type of backup to execute (‘full’ or ‘inc’)

Contents of successful response

“success”
backup.restore_backup(response_format)

Restore a backup

URL

/papi/backup/backup/restore[. response_format]

response_format can be xml or json (defaults to json)

HTTP METHOD

POST

POST Parameters

  • storage_name:

    Name of the storage where the backup to restore is stored

  • backup_name:

    Name of the backup to restore

  • restore_date:

    Human-readable date of the backup to restore in local timezone

  • encryption_key:

    Key to use to decrypt the backup (required only if backups are encrypted)

  • timezone:

    Local timezone

  • hostname:

    Name of the hostname on which the backup to restore has been created This parameter is optional; if left blank, the name of the current server (the one processing the API request) will be used

Contents of successful response

“success”
backup.list_backups(response_format)

List available backups on a storage

URL

/papi/backup/backup/list[. response_format]

response_format can be xml or json (defaults to json)

HTTP METHOD

GET, POST

POST Parameters

  • storage_name:

    Name of the storage where the backups to list are stored. This parameter is optional; if left blank, the returned content will contains informations for all storages

  • hostname:

    Name of the server from which the backups to list have been created. This parameter is optional; if left blank, the name of the current server (the one processing the API request) will be used

  • timezone:

    Local timezone

  • date_from:

    Low boundary of a date range used to filter returned backups. If not specified, no low boundary filtering is applied

  • date_to:

    High boundary of a date range used to filter returned backups. If not specified, no high boundary filtering is applied

Contents of successful response

Dictionary of dictionary.

First level

The first level of dictionary maps a storage with a set of backups For each entry, the key represents the name of the storage and the associated value the list of backups on this storage for the designated server:

{'storage1':<second level object>, 'storage2':<second level object>, ...} 

Second level

Each dictionary on the second level describes a list of backups For each entry, the key represents the name of the backup and the associated value is a list of actual backups of this backup name:

{'backup1':[<third level object>],'backup2':[<third level object>]...}

Third level

The third level is a dictionary that describes a backup stored on a storage; it contains:

  • date:

    Human-readable date of the backup in the local timezone

  • path:

    Extended name of backup

  • full:

    boolean that indicates if the backup is a full backup (true) or an incremental (false)

  • encrypted:

    boolean set if the backup is encrypted

  • hostname:

    Name of the server from which the backups to list have been created. This basically matched the parameter “hostname” sent in the request. However if the parameter is omited in the request, the retured value will be set to the name of the current server (the one processing the API request) Note that this information is redondant across all listed backups.

To summarize:

{'storage1':
    {'backup1':[
        {'date': '...', 'path': '...', 'full': true, 'encrypted': false, 'hostname': 'myserver'},
        {'date': '...', 'path': '...', 'full': false, 'encrypted': false, 'hostname': 'myserver'},
        {'date': '...', 'path': '...', 'full': false, 'encrypted': false, 'hostname': 'myserver'}],
    'backup2':[
        {'date': '...', 'path': '...', 'full': true, 'encrypted': true, 'hostname': 'myserver'},
        {'date': '...', 'path': '...', 'full': true, 'encrypted': false, 'hostname': 'myserver'},
        {'date': '...', 'path': '...', 'full': false, 'encrypted': false, 'hostname': 'myserver'}]},
'storage2':
    {'backup1':[
        {'date': '...', 'path': '...', 'full': true, 'encrypted': true, 'hostname': 'myserver'},
        {'date': '...', 'path': '...', 'full': false, 'encrypted': true, 'hostname': 'myserver'},
        {'date': '...', 'path': '...', 'full': false, 'encrypted': true, 'hostname': 'myserver'}],
    'backup3':[
        {'date': '...', 'path': '...', 'full': true, 'encrypted': false, 'hostname': 'myserver'},
        {'date': '...', 'path': '...', 'full': true, 'encrypted': false, 'hostname': 'myserver'},
        {'date': '...', 'path': '...', 'full': true, 'encrypted': false, 'hostname': 'myserver'}]}}
backup.list_hostnames(response_format)

List name of servers that have at least one valid backup on a storage

URL

/papi/backup/backup/list-hostname[. response_format]

response_format can be xml or json (defaults to json)

HTTP METHOD

GET, POST

POST Parameters

  • storage_name:

    Name of the storage where the backups are stored. This parameter is optional; if left blank, the returned content will contains informations for all storages

Contents of successful response

Dictionary of list.

For each entry, the key represents the name of the storage and the associated value is a list server names that have a valid backup on this storage

To summarize:

{'storage1':['server1','server2'],
'storage2':['server1','server3'],
'storage3':['server3']}
backup.add_backup_config(response_format)

Add a new configuration for a backup

URL

/papi/backup/backup-config/add[. response_format]

response_format can be xml or json (defaults to json)

HTTP METHOD

POST

POST Parameters

  • backup_name:

    Name of the backup configuration to add

  • storage_id:

    Unique identifier of the storage where the backups shoud be stored

  • encryption_key:

    Encryption key to use during the backup. Encryption rely on a aes256 CBC and is done on the server side. When activated, all data are encrypted before being sent to the storage. This parameter is optional; if left blank the backups will not be encrypted

The next parameters exists both for the full and incremental backup configurations; in each name, <type> has to be replaced either by ‘full’ or ‘inc’

  • schedule_<type>_period:

    Human-readable period of the backup. Must be one of: ‘deactivated’,’yearly’,’monthly’,’weekly’,’daily’ or ‘hourly’

  • schedule_<type>_frequency:

    Frequency of the backup in the defined period For example period=’yearly’ and frequency=2 means every other month

  • schedule_<type>_time_list:

    List of time to run the backup; meaning depends on value of schedule_<type>_period ‘deactivated’: does not matter ‘yearly’: list of months (1-12) ‘monthly’: list of days (1-31) ‘weekly’: list of day of the week (0-6) ‘daily’: does not matter ‘hourly’: list of hours (0-23)

  • schedule_<type>_day_run:

    Comma separated list of days to run the backup on; valid only if period is ‘yearly’

  • schedule_<type>_time_run:

    Comma separated list of hours to run the backup on; valid only if period is ‘yearly’,’monthly’,’weekly’ or ‘daily’

Contents of successful response

‘success’
backup.update_backup_config(response_format)

Add a new configuration for a backup

URL

/papi/backup/backup-config/edit[. response_format]

response_format can be xml or json (defaults to json)

HTTP METHOD

POST

POST Parameters

All POST parameters defined for the function add_backup_config, extended by:

  • backup_id:

    Unique identifier of the backup configuration to update

Contents of successful response

‘success’
backup.list_backup_config(response_format)

List existing backup configurations

URL

/papi/backup/backup-config/list[. response_format]

response_format can be xml or json (defaults to json)

HTTP METHOD

GET, POST

GET, POST Parameters

  • timezone:

    Local timezone

Contents of successful response

List of dictionaries

Each dictionary represents a backup configuration and contains:

  • backup_id:

    Unique identifier of the backup configuration

  • backup_name:

    Name of the backup configuration

  • storage_name:

    Name of the storage where the backups are stored

  • encryption_key:

    Encryption key to use during the backup

  • full:

    Dictionary <last backup> that represents the status of the last full backup

  • inc:

    Dictionary <last backup> that represents the status of the last incremental backup

A dictionary <last backup> describes the status of the last backup job associated with this backup configuration; it contains:

  • job_status:

    Human-readable status of the backup job (‘waiting’, ‘running’, ‘success’ or ‘failed’)

  • description:

    A description of the current status (set only when the job is terminated)

  • start_date:

    Human-readable date in the local timezone when the job was added

  • end_date:

    Human-readable date in the local timezone when the job was finished (in success or failure)

backup.get_backup_config(response_format)

Get the configuration of a backup

URL

/papi/backup/backup-config/get[. response_format]

response_format can be xml or json (defaults to json)

HTTP METHOD

GET, POST

GET, POST Parameters

  • backup_name:

    Name of the backup configuration to retrieve

Contents of successful response

The answer is a dictionary with 3 entries:

  • “config”: dictionary <general config> with general configuration
  • “full”; dictionary <schedule> with configuration of full backups
  • “inc”; dictionary <schedule> with configuration of incremental backups

dictionary <general config>

This dictionary represents the general configuration; it contains:

  • backup_id:

    Unique identifier of the backup configuration

  • backup_name:

    Name of the backup configuration

  • storage_name:

    Name of the storage where the backups are stored

  • encryption_key:

    Encryption key to use during the backup

dictionary <schedule>

This dictionary represents the schedule configuration; the structure is similar for full and incremental configuration

  • period:

    Human-readable period of the backup. Must be one of: ‘deactivated’,’yearly’,’monthly’,’weekly’,’daily’ or ‘hourly’

  • frequency:

    Frequency of the backup in the defined period For example period=’yearly’ and frequency=2 means every other month

  • time_list:

    List of time to run the backup; meaning depends on value of schedule_<type>_period ‘deactivated’: does not matter ‘yearly’: list of months (1-12) ‘monthly’: list of days (1-31) ‘weekly’: list of day of the week (0-6) ‘daily’: does not matter ‘hourly’: list of hours (0-23)

  • day_run:

    Comma separated list of days the backup will run on; valid only if period is ‘yearly’

  • time_run:

    Comma separated list of hours the backup will run on; valid only if period is ‘yearly’,’monthly’,’weekly’ or ‘daily’

  • backup_type:

    Deprecated field that should not be used

  • template:

    Deprecated field that should not be used

backup.delete_backup_config(response_format)

Delete an existing backup configuration

URL

/papi/backup/backup-config/del[. response_format]

response_format can be xml or json (defaults to json)

HTTP METHOD

POST

POST Parameters

  • backup_id:

    Unique identifier of the backup configuration to delete

Contents of successful response

“success”
backup.test_backup_config(response_format)

Test the configuration of a backup

URL

/papi/backup/backup-config/test[. response_format]

response_format can be xml or json (defaults to json)

HTTP METHOD

GET, POST

GET, POST Parameters

  • backup_id:

    Unique identifier of the backup configuration to test

Contents of successful response

“success”
backup.list_ssh_ids(response_format)

List all existing ssh id

URL

/papi/backup/ssh-id/list[. response_format]

response_format can be xml or json (defaults to json)

HTTP METHOD

GET, POST

Contents of successful response

List of dictionaries. Each dictionary reprensents an exising ssh id and contains:

  • ssh_id_id:

    Unique identifier of the ssh id

  • key_name:

    User-friendly name of the ssh id

  • key_length:

    Length of the key associated with this ssh id

backup.generate_new_ssh_id(response_format)

Generate a new ssh id

URL

/papi/backup/ssh-id/new[. response_format]

response_format can be xml or json (defaults to json)

HTTP METHOD

POST

GET, POST Parameters

  • key_name:

    User-friendly name of the ssh id

  • key_length:

    Length of the key to create

Contents of successful response

‘success’
backup.delete_ssh_id(response_format)

Delete an existing ssh id

URL

/papi/backup/ssh-id/del[. response_format]

response_format can be xml or json (defaults to json)

HTTP METHOD

POST

POST Parameters

  • ssh_id_id:

    Unique identifier of the ssh id to delete

Contents of successful response

“success”
backup.get_pub_ssh_id(response_format)

Retrieve the public part of the key associated with a ssh id

URL

/papi/backup/ssh-id/get-pub[. response_format]

response_format can be xml or json (defaults to json)

HTTP METHOD

GET, POST

GET, POST Parameters

  • ssh_id_id:

    Unique identifier of the ssh id to retrieve

Contents of successful response

Dictionary that contains:

  • pub_key:

    Value of the public part

    Example:

    "ssh-rsa AAA ... hgF== root@manager3"
    

Error Codes

backup.LLAPI_BACKUP_ERROR__INVALID_CREDENTIAL_STORAGE

Error code 4000: Returned when credential configured to access a storage are invalid

backup.LLAPI_BACKUP_ERROR__INVALID_STORAGE

Error code 4001: Returned when configured storage is invalid

backup.LLAPI_BACKUP_ERROR__INVALID_DECRYPTION_KEY

Error code 4002: Returned when given decrytion key is not valid

backup.LLAPI_BACKUP_ERROR__DECRYPTION_KEY_MISSING

Error code 4003: Returned when the decryption key is missing

backup.LLAPI_BACKUP_ERROR__CORRUPTED_BACKUP

Error code 4004: Returned when the remote backup is corrupted

backup.LLAPI_BACKUP_ERROR__TRANSFER_FAILED

Error code 4005: Returned when a file transfer failed