How to create a snapshot or deploy a snapshot using the CMJ REST API

How to create a snapshot or deploy a snapshot using the CMJ REST API

On this page:

Step-by-step guide for using the REST API

Snapshot Operations

Create a Snapshot

  • Go to the terminal and execute the curl command as below, which creates a snapshot.

Linux/Mac request

curl -u admin:admin -i -H "Content-Type: application/json" -X POST <jira-base-url>/rest/configuration-manager/api/1.6/snapshots -d ' { "name" : "Demo1", "description" : "This is a snapshot", "scope" : "projectWithIssues", "projectKey" : "TEST" } '

Example output of the Create Snapshot:

HTTP/2 201 cache-control: no-cache, no-store, no-transform content-security-policy: sandbox content-type: application/json;charset=UTF-8 date: Tue, 24 Jun 2025 11:45:21 GMT location: <Jira Base URL>/rest/configuration-manager/api/1.6/snapshots/11 referrer-policy: strict-origin-when-cross-origin set-cookie: cookie=78bc12f338f3923b; Path=/; HttpOnly; Secure; SameSite=None set-cookie: JSESSIONID=B785245510E08CCE87AB939F2E8B5226; Path=/; Secure; HttpOnly set-cookie: atlassian.xsrf.token=BU4Z-172T-KKTC-ZZVE_5a58e7ec6c3cc87ed88d4343eaf589cef733791e_lin; Path=/; Secure; SameSite=None strict-transport-security: max-age=31536000 vary: User-Agent x-arequestid: 705x31513x1 x-asessionid: znsgp4 x-ausername: automation x-content-type-options: nosniff x-frame-options: SAMEORIGIN x-seraph-loginreason: OK x-xss-protection: 1; mode=block {"id":11,"objectCount":91}%

The snapshot with the name Demo1 is created, as shown in the screenshot below. You can navigate to the snapshot created under Jira Settings --> Configuration Manager → Snapshots.

image-20250624-123224.png

Windows request

  • Go to the Command prompt and run the command below, which creates a snapshot.

curl -u admin:admin -i -H "Content-Type: application/json" -X POST <jira-base-url>/rest/configuration-manager/api/1.6/snapshots -d^ "{^ \"name\" : \"My snapshot\",^ \"description\" : \"This is a snapshot\",^ \"scope\" : \"projectWithIssues\",^ \"projectKey\" : \"TEST"^ }"

Get snapshot metadata

  • Go to the terminal and execute the curl command as below.

curl -u admin:admin -H "Content-Type: application/json" -X GET <jira-base-url>/rest/configuration-manager/api/1.6/snapshots

Download a snapshot zip

  • Go to the terminal and execute the curl command as below, which downloads a snapshot.

curl -u admin:admin -H "Content-Type: application/json" -X GET <jira-base-url>/rest/configuration-manager/api/1.6/snapshots/1 > snapshot.zip

Delete a snapshot

  • Go to the terminal and execute the curl command as below, which deletes a snapshot.

curl -u admin:admin -i -H "Content-Type: application/json" -X DELETE <jira-base-url>/rest/configuration-manager/api/1.6/snapshots/1

Example output of the Delete snapshot

HTTP/2 204 cache-control: no-cache, no-store, no-transform content-security-policy: sandbox content-type: application/json;charset=UTF-8 date: Tue, 24 Jun 2025 12:06:03 GMT referrer-policy: strict-origin-when-cross-origin set-cookie: cookie=78bc12f338f3923b; Path=/; HttpOnly; Secure; SameSite=None set-cookie: JSESSIONID=F18C5777FBFA4176734AC3D280A8886A; Path=/; Secure; HttpOnly set-cookie: atlassian.xsrf.token=BU4Z-172T-KKTC-ZZVE_0ed06e937ab66b1b0df2dde0d3f947216821253a_lin; Path=/; Secure; SameSite=None strict-transport-security: max-age=31536000 x-arequestid: 726x31658x1 x-asessionid: jjo5uw x-ausername: automation x-content-type-options: nosniff x-frame-options: SAMEORIGIN x-seraph-loginreason: OK x-xss-protection: 1; mode=block

Deployment operations

Deploy a Snapshot

  • Go to the terminal and execute the curl command as below, which deploys a snapshot.

curl -u admin:admin -i -H "Content-Type: application/json" -X POST <Jira Base URL>/rest/configuration-manager/api/1.6/deployments -d ' { "scope" : "project", "mode" : "SingleProject", "options" : { "createNewProject" : true, "newProjectKey" : "DEMO1", "newProjectName" : "Demo1", "mergeVersionsAndComponents" : false, "mergeProjectRoles": false } }'

Example output of the Deploy snapshot

HTTP/2 201 cache-control: no-cache, no-store, no-transform content-security-policy: sandbox content-type: application/json;charset=UTF-8 date: Tue, 24 Jun 2025 12:13:28 GMT location: <Jira Base URL/rest/configuration-manager/api/1.6/deployments/1 referrer-policy: strict-origin-when-cross-origin set-cookie: cookie=913ce7e477709254; Path=/; HttpOnly; Secure; SameSite=None set-cookie: JSESSIONID=32E33BF357155D01B6A7315896EE21B4; Path=/; Secure; HttpOnly set-cookie: atlassian.xsrf.token=BU4Z-172T-KKTC-ZZVE_fad2552921d18a9f31fd0e6eafea0a467ee8f669_lin; Path=/; Secure; SameSite=None strict-transport-security: max-age=31536000 vary: User-Agent x-arequestid: 733x4875x1 x-asessionid: n6sxhw x-ausername: automation x-content-type-options: nosniff x-frame-options: SAMEORIGIN x-seraph-loginreason: OK x-xss-protection: 1; mode=block {"id":1}%

The deployment id changes whenever a new snapshot is deployed. Here in the above output example, the deployment ID is 1

Upload a Snapshot zip

Here, also, the deployment ID changes whenever a snapshot is uploaded. Here in the below command, the deployment id is 1

curl -u admin:admin -i -X PUT <Jira base URL>/rest/configuration-manager/api/1.6/deployments/1/content -F file=@'Demo1.zip'

Example output of an Upload snapshot

HTTP/2 200 cache-control: no-cache, no-store, no-transform content-security-policy: sandbox content-type: application/json;charset=UTF-8 date: Tue, 24 Jun 2025 12:15:50 GMT referrer-policy: strict-origin-when-cross-origin set-cookie: cookie=913ce7e477709254; Path=/; HttpOnly; Secure; SameSite=None set-cookie: JSESSIONID=B69EAD28042B949F90341189A837B68D; Path=/; Secure; HttpOnly set-cookie: atlassian.xsrf.token=BU4Z-172T-KKTC-ZZVE_6668bd8161c0a44c6d8362c82b5d394023f2e7e8_lin; Path=/; Secure; SameSite=None strict-transport-security: max-age=31536000 vary: User-Agent x-arequestid: 735x4887x1 x-asessionid: yfbo43 x-ausername: automation x-content-type-options: nosniff x-frame-options: SAMEORIGIN x-seraph-loginreason: OK x-xss-protection: 1; mode=block

The Demo1 project is created as shown in the screenshot below. You can refer to the created project under Projects--> View all Projects.

image-20250624-123946.png