...
The current API version is 1.45.
For example you would use the following path to access the snapshots API on a locally run instance of Jira with a context path of /jira:
Code Block |
---|
http://localhost:2990/jira/rest/configuration-manager/api/1.45/snapshots |
Keep in mind that the context path may be different or not present for your installation of Jira.
...
Creating a new snapshot*
Unix/MacOS Request
Code Block language bash curl -u admin:admin -i -H "Content-Type: application/json" -X POST <jira-base-url>/rest/configuration-manager/api/1.45/snapshots -d ' { "name" : "My snapshot", "description" : "Very nice snapshot", "scope" : "system" } '
Note that on Windows machines single quotes around JSON might not work. Try escaping them like "{\"name\":\"My snapshot\"...
Windows Request
Code Block language bash curl -u admin:admin -i -H "Content-Type: application/json" -X POST <jira-base-url>/rest/configuration-manager/api/1.45/snapshots -d^ "{^ \"name\" : \"My snapshot\",^ \"description\" : \"Very nice snapshot\",^ \"scope\" : \"system\"^ }"
Response
Code Block language bash HTTP/1.1 201 Created ... Location: <jira-base-url>/rest/configuration-manager/api/1.45/snapshots/1 Content-Type: application/json;charset=UTF-8 ... { "id" : 1, "objectCount" : 86 }
Downloading a snapshot ZIP
Request
Code Block language bash curl -u admin:admin -H "Content-Type: application/json" -X GET <jira-base-url>/rest/configuration-manager/api/1.45/snapshots/1 > snapshot.zip
The snapshot will be saved in snapshot.zip file in the current directory
Response
Code Block language bash HTTP/1.1 200 OK ... Content-Type: application/octet-stream
Deleting a snapshot
Request
Code Block language bash curl -u admin:admin -i -H "Content-Type: application/json" -X DELETE <jira-base-url>/rest/configuration-manager/api/1.45/snapshots/1
Response
Code Block language bash HTTP/1.1 204 No Content ...
Snapshot deployment
Deployment is a two step process - first meta information is provided and then a snapshot file is uploaded. The operation is asynchronous, a separate REST endpoint is used for tracking deployment progress.
Starting a deployment operation
Unix/MacOS Request
Code Block language bash curl -u admin:admin -i -H "Content-Type: application/json" -X POST <jira-base-url>/rest/configuration-manager/api/1.45/deployments -d ' { "scope" : "system", "mode" : "systemRestore" } '
Note that on Windows machines single quotes around json might not work. Try escaping them like "{\"name\":\"My snapshot\"...Windows Request
Code Block language bash curl -u admin:admin -i -H "Content-Type: application/json" -X POST <jira-base-url>/rest/configuration-manager/api/1.45/deployments -d^ "{^ \"scope\" : \"system\",^ \"mode\" : \"systemRestore\"^ }"
Response
Code Block language bash HTTP/1.1 201 Created ... Location: <jira-base-url>/rest/configuration-manager/api/1.45/deployments/1 Content-Type: application/json;charset=UTF-8 ... { "id" : 1 }
Uploading a snapshot ZIPÂ file
Executed from the directory where the snapshot.zip snapshot file is. Note that the ID of the deployment operation needs to be provided (in this case "1").
Request
Code Block language bash curl -u admin:admin -i -X PUT <jira-base-url>/rest/configuration-manager/api/1.45/deployments/1/content -F file=@snapshot.zip
Response
Code Block language bash HTTP/1.1 200 OK ...
Checking the deployment status
Request
Code Block language bash curl -u admin:admin -i -H "Content-Type: application/json" -X GET <jira-base-url>/rest/configuration-manager/api/1.45/deployments/1
Response
Code Block language bash HTTP/1.1 200 OK ... Content-Type: application/json;charset=UTF-8 ... { "id" : 1, "status" : "succeeded" }
...