according to this workarround.
https://confluence.atlassian.com/confkb/how-to-disable-notifications-for-attachments-action-862622270.html
I need to disable notifications when an attachments is uploaded in confluence.
I did a Groovy code to perform it.
But The response is allways 401
Tried with basic and bearer token autentificación
import javax.xml.bind.DatatypeConverter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
URL url = new URL("MYCONFLUENCEURL/rest/plugins/1.0/com.atlassian.confluence.plugins.confluence-file-notifications-key/modules/file-content-remove-notification-key");
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
httpConn.setRequestMethod("PUT");
httpConn.setRequestProperty("Content-Type", "application/vnd.atl.plugins.plugin.module+json");
httpConn.setRequestProperty("Authorization", "Bearer " + "MYTOKEN");
httpConn.setDoOutput(true);
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
writer.write("{\n \"enabled\": false\n}");
writer.flush();
writer.close();
httpConn.getOutputStream().close();
InputStream responseStream = httpConn.getResponseCode() / 100 == 2
? httpConn.getInputStream()
: httpConn.getErrorStream();
Scanner s = new Scanner(responseStream).useDelimiter("\\A");
String response = s.hasNext() ? s.next() : "";
log.warn(response);
Regards,
Hi @Sergio _
You may need to temporarily disable the websudo feature while running that script.
Is this an option to your use case?
Kind regards,
Thiago Masutti
Hi thiago. It is working disable the sudo option.
Do you know how to do a rollback?
I tried
writer.write("{\n \"enabled\": true\n}");
but it is not working
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That should be it.
What is the output you get when trying to enable it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yeah, I got the same problem when trying to enable that module. Seems like you can't simply re-enable it.
I was able to revert it by disabling the full App and then enabling it again.
--- disable system App
curl -vvv -k -L -X PUT \
-H 'Content-Type: application/vnd.atl.plugins.plugin+json' -u admin:admin \
${CONFLUENCE_BASE_URL}'/rest/plugins/1.0/com.atlassian.confluence.plugins.confluence-file-notifications-key' \
-d '{ "enabled": false }'
--- enable system App
curl -vvv -k -L -X PUT \
-H 'Content-Type: application/vnd.atl.plugins.plugin+json' -u admin:admin \
${CONFLUENCE_BASE_URL}'/rest/plugins/1.0/com.atlassian.confluence.plugins.confluence-file-notifications-key' \
-d '{ "enabled": true }'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sergio.
In regards to your original issue with websudo, I've created a new bug as I understand this should bypass the websudo requirement when using PAT.
UPM-6129 -- When websudo is enabled then UPM REST API fails with 401 Unauthorized response when authenticating with personal access token
Kind regards,
Thiago Masutti
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sergio.
That means you should disable and then enable the entire Plugin (Confluence File Notification) instead of just trying to enable the module.
You may try the following API calls to accomplish that.
--- disable system App
curl -vvv -k -L -X PUT \
-H 'Content-Type: application/vnd.atl.plugins.plugin+json' -u admin:admin \
${CONFLUENCE_BASE_URL}'/rest/plugins/1.0/com.atlassian.confluence.plugins.confluence-file-notifications-key' \
-d '{ "enabled": false }'
--- enable system App
curl -vvv -k -L -X PUT \
-H 'Content-Type: application/vnd.atl.plugins.plugin+json' -u admin:admin \
${CONFLUENCE_BASE_URL}'/rest/plugins/1.0/com.atlassian.confluence.plugins.confluence-file-notifications-key' \
-d '{ "enabled": true }'
Kind regards,
Thiago Masutti
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Thiago Masutti
what about versioning notifications. I need to disable those notifications too.
Can I do the same disabling file-notifications-file-details-file-version module?
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.