How to Enable UPM Safe Mode using UPM REST API
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Background
Sometimes, it might be useful to set up the UPM to Safe Mode in your instance. This is useful as this will disable all third party plugins and will assist to isolating issues that may be caused by one or more of these plugins. While the link explains how to do so manually, you might want to do this through a REST call.
Enabling, Disabling and Checking the Safe Mode status through cUrl
Enabling Safe Mode
You can run the following cUrl command to enable safe mode over the REST API. We present examples for both basic authentication and Personal Access Tokens
Using basic authentication
For Linux/Mac
1
$ curl -H "Content-Type:application/vnd.atl.plugins.safe.mode.flag+json" --user username:password -X PUT -d '{"enabled": true, "links": {}}' http://localhost:8090/rest/plugins/1.0/safe-mode
ℹ️ Replace username:password with your actual username and password
Expected response:
1
{"enabled":true,"links":{"exit-safe-mode-restore":"/rest/plugins/1.0/safe-mode?keepState=false","exit-safe-mode-keep":"/rest/plugins/1.0/safe-mode?keepState=true"}}
For Windows:
1
curl -H "Content-Type:application/vnd.atl.plugins.safe.mode.flag+json" --user username:password -X PUT -d "{\"enabled\": true, \"links\": {}}" "http://localhost:8090/rest/plugins/latest/safe-mode"
ℹ️ Replace username:password with your actual username and password
Using Personal Access Token
For Linux/MAC
1
curl -H "Authorization: Bearer <token>" -H "Content-Type:application/vnd.atl.plugins.safe.mode.flag+json" -X PUT -d '{"enabled": true, "links": {}}' http://localhost:8090/rest/plugins/1.0/safe-mode
ℹ️ replace <token> with your Personal Access Token
Disabling Safe Mode
You can run the following cURL call to disable the UPM Safe mode:
Using Basic Authentication
For Linux/Mac:
1
$ curl -H "Content-Type:application/vnd.atl.plugins.safe.mode.flag+json" --user username:password -X PUT -d '{"enabled": false, "links": {}}' http://localhost:8090/rest/plugins/1.0/safe-mode
ℹ️ Replace username:password with your actual username and password
Expected response:
1
{"enabled":false,"links":{"safe-mode":"/rest/plugins/1.0/safe-mode"}}
For Windows:
1
$ curl -H "Content-Type:application/vnd.atl.plugins.safe.mode.flag+json" --user username:password -X PUT -d "{\"enabled\": false, \"links\": {}}" "http://localhost:8090/rest/plugins/1.0/safe-mode"
ℹ️ Replace username:password with your actual username and password
Using Personal Access Token
For Linux/MAC
1
curl -H "Authorization: Bearer <token>" -H "Content-Type:application/vnd.atl.plugins.safe.mode.flag+json" -X PUT -d '{"enabled": false, "links": {}}' http://localhost:8090/rest/plugins/1.0/safe-mode
ℹ️ replace <token> with your Personal Access Token
Checking Safe Mode Status
You can always check UPM status by using the call below:
1
$ curl -u username:password http://localhost:8090/rest/plugins/latest/safe-mode
Expected Response:
1
{"enabled":false,"links":{"safe-mode":"/rest/plugins/1.0/safe-mode"}}
ℹ️ The above example is when using basic authentication. If you are using Personal Access Tokens, adjust the command accordingly (you may use the examples from enable and disable samples above as reference.
Was this helpful?