Class BackupRestoreResource
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionjavax.ws.rs.core.Response
Cancels all queued jobs.javax.ws.rs.core.Response
Cancels the job.javax.ws.rs.core.Response
createSiteBackupJob
(SiteBackupSettings settings) Starts the new site backup job.javax.ws.rs.core.Response
createSiteRestoreJob
(SiteRestoreSettings settings) Starts the new site restore job.javax.ws.rs.core.Response
createSiteRestoreJobForUploadedBackupFile
(com.atlassian.plugins.rest.common.multipart.FilePart file) Starts the new site restore job for the uploaded backup file (Zip).javax.ws.rs.core.Response
createSpaceBackupJob
(SpaceBackupSettings settings) Creates new space backup job and adds it to the queue.javax.ws.rs.core.Response
createSpaceRestoreJob
(SpaceRestoreSettings settings) Creates new space restore job and adds it to the queue.javax.ws.rs.core.Response
createSpaceRestoreJobForUploadedBackupFile
(com.atlassian.plugins.rest.common.multipart.FilePart file) Starts the new space restore job for the uploaded backup file (Zip).javax.ws.rs.core.Response
downloadBackupFile
(Long jobId) Downloads the backup file for the given job.javax.ws.rs.core.Response
findJobs
(Integer limit, String fromDate, String toDate, JobScope jobScope, JobOperation jobOperation, List<JobState> jobStates, String spaceKey, String owner) Returns jobs based on the filters provided.javax.ws.rs.core.Response
returns list of information on files in conf-home/restore/(jobScope)javax.ws.rs.core.Response
Get job by id.
-
Constructor Details
-
BackupRestoreResource
-
-
Method Details
-
createSpaceBackupJob
Creates new space backup job and adds it to the queue.- Parameters:
settings
- space backup settings- Returns:
- space backup job details
-
createSiteBackupJob
Starts the new site backup job.- Parameters:
settings
- site backup settings- Returns:
- site backup job details
-
createSpaceRestoreJob
Creates new space restore job and adds it to the queue.- Parameters:
settings
- space restore settings- Returns:
- space restore job details
-
createSiteRestoreJob
Starts the new site restore job.- Parameters:
settings
- site restore settings- Returns:
- site restore job details
-
createSpaceRestoreJobForUploadedBackupFile
public javax.ws.rs.core.Response createSpaceRestoreJobForUploadedBackupFile(com.atlassian.plugins.rest.common.multipart.FilePart file) throws IOException Starts the new space restore job for the uploaded backup file (Zip).This resource expects a multipart post. The media-type multipart/form-data is defined in RFC 1867. Most client libraries have classes that make dealing with multipart posts simple. For instance, in Java the Apache HTTP Components library provides a MultiPartEntity that makes it simple to submit a multipart POST.
In order to protect against XSRF attacks, because this method accepts multipart/form-data, it has XSRF protection on it. This means you must submit a header of X-Atlassian-Token: nocheck with the request, otherwise it will be blocked.
The name of the multipart/form-data parameter that contains attachments must be "file"
An example to attach the file
curl -D- -u admin:admin -X POST -H "X-Atlassian-Token: nocheck" -F "file=@myfile.zip" http://myhost/rest/api/backup-restore/restore/space/upload"
- Parameters:
file
- backup file uploaded. Has to be a zip file.- Returns:
- space restore job details
- Throws:
IOException
-
createSiteRestoreJobForUploadedBackupFile
public javax.ws.rs.core.Response createSiteRestoreJobForUploadedBackupFile(com.atlassian.plugins.rest.common.multipart.FilePart file) throws IOException Starts the new site restore job for the uploaded backup file (Zip).This resource expects a multipart post. The media-type multipart/form-data is defined in RFC 1867. Most client libraries have classes that make dealing with multipart posts simple. For instance, in Java the Apache HTTP Components library provides a MultiPartEntity that makes it simple to submit a multipart POST.
In order to protect against XSRF attacks, because this method accepts multipart/form-data, it has XSRF protection on it. This means you must submit a header of X-Atlassian-Token: nocheck with the request, otherwise it will be blocked.
The name of the multipart/form-data parameter that contains attachments must be "file"
An example to attach the file
curl -D- -u admin:admin -X POST -H "X-Atlassian-Token: nocheck" -F "file=@myfile.zip" http://myhost/rest/api/backup-restore/restore/site/upload"
- Parameters:
file
- backup file uploaded. Has to be a zip file.- Returns:
- site restore job details
- Throws:
IOException
-
getJob
Get job by id. The user must be a sysadmin or the owner of the job- Parameters:
jobId
- id of the backup/restore job- Returns:
- job details
-
findJobs
public javax.ws.rs.core.Response findJobs(Integer limit, String fromDate, String toDate, JobScope jobScope, JobOperation jobOperation, List<JobState> jobStates, String spaceKey, String owner) Returns jobs based on the filters provided.- Parameters:
limit
- amount of jobs that should be returnedfromDate
- minimum job creation date. Supported date format is `yyyy-MM-ddTHH:mm:ss.SSSZ`toDate
- maximum job create date. Supported date format is `yyyy-MM-ddTHH:mm:ss.SSSZ`jobScope
- scope of the job. Acceptable values: "SPACE" and "SITE"jobOperation
- job operation. Acceptable values: "BACKUP" and "RESTORE"jobStates
- list of job states. Acceptable values: "QUEUED", "PROCESSING", "FINISHED", "CANCELLING", "CANCELLED", "FAILED"owner
- userName of user who had created a job- Returns:
- List of backup/restore jobs visible to user based on the filter provided and the user's permissions.
-
getFiles
returns list of information on files in conf-home/restore/(jobScope)- Parameters:
jobScope
- name of type of restore job (SITE or SPACE or null), if null, all backup files are listed- Returns:
- List of FileInfo objects, containing fileName, fileCreationTime, fileSize, and jobScope
-
cancelJob
Cancels the job. If the job is already cancelled or failed, the method will do nothing.- Parameters:
jobId
- id of the backup/restore job- Returns:
- details of cancelled job
-
downloadBackupFile
Downloads the backup file for the given job. Requires site admin or space export permissions for all spaces included in the backup job.- Parameters:
jobId
- id of the backup/restore job- Returns:
- Complete data stream of the file contents
-
cancelAllQueuedJobs
public javax.ws.rs.core.Response cancelAllQueuedJobs()Cancels all queued jobs. Does not affect jobs that are being processed at the moment.- Returns:
- number of cancelled jobs.
-