Logic for create download backup form API 5

cPanel, Industry leading hosting platform with world-class support.
Post Reply
castris
Posts: 7
Joined: January 27th, 2023, 8:00 pm

Logic for create download backup form API 5

Post by castris »

I'm trying to see how using jetbackup5api I can create a full backup, of type download.

It is true that it could well be done in another way since the objective is:
- Create a complete backup although the last complete backup could also be used (the first option is preferable, since the execution, I suppose, will return the information of the result with its incidents)
- Obtain the backup information to transfer it to a glacier backup.

It is an operation that my client wants when he cancels an account, and he wants to keep the last backup file for 5 years.

Help appreciated.
JetAppsAdam
Staff Member
Staff Member
Posts: 74
Joined: August 5th, 2022, 11:01 pm

Re: Logic for create download backup form API 5

Post by JetAppsAdam »

Hello castris,

To start with, we are going to need to get the account ID belonging to the account we wish to download a backup for. We can get this using the listAccounts API call.

Code: Select all

jetbackup5api -F listAccounts | grep -w 'username: {account_name}' -B 2
This should provide you with the following output:

Code: Select all

 _id: 646e89d7fd06cbf8060d3ce3
      uuid: 3abae668b85f36fe202590c3706987d750dfb0d8
      username: {account_name}
The '_id' is the string that you are looking for. From this call, we can use the account ID for the listBackups call to find available backups for the desired account. An example call would be requesting all full account backups for our desired account using the following:

Code: Select all

jetbackup5api -F listBackups -D 'type=1&contains=511&account_id={account_id}' |  grep 'parent_id'
Once you have the "parent_id" of the desired backup, you can generate a download of this backup using the following API call:

Code: Select all

jetbackup5api -F addQueueItems -D 'type=4&snapshot_id={parent_id}'
Make sure that you use the "parent_id" from the desired backup in the "snapshot_id" section of the download API call.
Thank you,

Adam G
JetApps, LLC.
JetApps.com | JetBackup.com
castris
Posts: 7
Joined: January 27th, 2023, 8:00 pm

Re: Logic for create download backup form API 5

Post by castris »

A lot of thanks.
Post Reply