There are three endpoints regarding backups of Xray information.
Generate a Backup | /api/v1/backup |
Check backup job status | /api/v1/backup/{jobId}/status |
Get backup file | /api/v1/backup/file |
Get attachment backup file | /api/v1/backup/file/attachment |
The first endpoint is an asynchronous call to generate a backup. Whenever this endpoint is called, a job is queued to create the backup and its id is returned. The second endpoint can be used to check the status of this job.
Generate a Backup
When importing tests, you can use the following endpoint:
Create a job to generate a backup. Request In the body of the request the following fields can be used:
- projectIds (optional): This field determines which projects to backup. This field is optional, if omitted, the backup will contain Xray information of all projects containing it.
- modifiedSince (optional): This field can hold a date in order for a partial backup to be generated containing only entities that were change from that date until now. This field is optional, if not supplied a full backup will be generated.
- withAttachment (optional): It determines if the a zip file with the attachments should also be generated.
Example 1: Example Input
{ "projectIds": ["10000", "10001"], "modifiedSince": "2020-04-25T00:00:00Z", "withAttachment": false }
|
curl -H "Content-Type: application/json" -X POST -H "Authorization: Bearer $token" --data @"data.json" https://xray.cloud.xpand-it.com/api/v1/backup |
Responses200 OK : application/json : Successful. The backup job was created successfully and the Job Id is provided. Example Output {
"jobId" : "34a4106b1d0948d1aae1170cc8df3bb4"
} |
400 BAD_REQUEST : application/json : No backup job was created. Another backup job is still running or was completed not long ago. Example Output
{
"error" : "A backup can be created once every 6 hours, you can create a new one in: 5 hours, 56 minutes and 47 seconds."
} |
401 UNAUTHORIZED: application/json: The API token is invalid.
|
|
Check a Backup Status
When importing tests, you can use the following endpoint:
Get a backup job status. Request PATH PARAMETERSparameter | type | description |
---|
jobId | String | - id of the generate backup job |
curl -H "Content-Type: application/json" -X GET -H "Authorization: Bearer $token" https://xray.cloud.xpand-it.com/api/v1/backup/34a4106b1d0948d1aae1170cc8df3bb4/status |
Responses 200 OK : application/json : The status of the backup job is returned. {
"status": "working",
"progressValue": "10%"
} |
{
"status": "successful",
"fileUrl": "https://xray.cloud.xpand-it.com/api/v1/backup/file",
"attachmentUrl": "https://xray.cloud.xpand-it.com/api/v1/backup/file/attachment"
} |
404 BAD_REQUEST : application/json : No backup job with the given id was found. {
"error": "job not found."
} |
401 UNAUTHORIZED : application/json : The API token is not valid. |
|
Download the backup file
To download the backup file, you can use the following endpoint:
Download the backup file.
Request curl -H "Content-Type: application/json" -X GET -H "Authorization: Bearer $token" https://xray.cloud.xpand-it.com/api/v1/backup/file |
Responses 200 OK : application/octet-stream: The backup file is downloaded.
404 NOT_FOUND : application/json : A backup file is not available. {
"error": "Backup file is not available."
} |
401 UNAUTHORIZED : application/json : The API token is not valid. |
|
Download the attachment backup file
To download the attachment backup file, you can use the following endpoint:
Download the backup file.
Request Responses 200 OK : application/octet-stream: The backup file is downloaded.
404 NOT_FOUND : application/json : A backup file is not available. {
"error": "Backup file is not available."
} |
401 UNAUTHORIZED : application/json : The API token is not valid. |
|