How to convert a snapshot file from .bin to .xml using CMJ REST API
By default, the CMJ snapshots are created as .bin files, and this format can be changed to XML using the Jira UI. You can also use the REST API to convert snapshots.
Please be advised that editing a snapshot XML is not recommended, as it may result in data corruption. We encourage you to proceed with caution and understand the associated risks.
Instructions
How to convert a snapshot file from .bin to .xml using CMJ REST API:
The first step returns the snapshot’s operation ID. The snapshot ID is needed to run this curl command.
curl -X POST https://<HOSTNAME>:<PORT>/rest/configuration-manager/1.0/snapshots/convert/{ID of the snapshot} -u CREDENTIALS -H "Content-Type: application/json" -s -w "\n"
Using the operation ID obtained in the first step and the curl command below, the progress can be checked:
curl -X GET https://<HOSTNAME>:<PORT>/rest/configuration-manager/1.0/snapshots/convert/progress/{ID of convert operation} -u CREDENTIALS -H "Content-Type: application/json" -s -w "\n"
Lastly, using the curl command below will download the file:
curl -X GET https://<HOSTNAME>:<PORT>/rest/configuration-manager/1.0/snapshots/download/{ID of convert operation} -u CREDENTIALS -H "Content-Type: application/json" >> <path to file>.zip
Check the below outputs to see how these commands work:
Check the before and after of this snapshot file as an example:
It is important to know that prior to deployment, it is not required to convert the snapshot file back to binary format (.bin). CMJ supports both XML and binary formats.