How to Enable UPM Safe Mode using UPM REST API

Still need help?

The Atlassian Community is here for you.

Ask the community

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

$ 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

(info) Replace username:password with your actual username and password

Expected response:

{"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:

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"

(info) Replace username:password with your actual username and password

Using Personal Access Token

For Linux/MAC

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

(info) 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:

$ 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

(info) Replace username:password with your actual username and password

Expected response:

{"enabled":false,"links":{"safe-mode":"/rest/plugins/1.0/safe-mode"}}

For Windows:

$ 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"

(info) Replace username:password with your actual username and password

Using Personal Access Token

For Linux/MAC

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

(info) replace <token> with your Personal Access Token

Checking Safe Mode Status 

You can always check UPM status by using the call below:

$ curl -u username:password http://localhost:8090/rest/plugins/latest/safe-mode

Expected Response:

{"enabled":false,"links":{"safe-mode":"/rest/plugins/1.0/safe-mode"}}

(info) 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. 



Last modified on Jan 25, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.