Hey everyone,
We have a space in our Confluence instance that contains sensitive data that has specific rules around getting sent via e-mail. Since there isn't a good way to natively set watches for a specific Space/Page I'm looking into periodically removing watches programmatically.
I have a way to gather all URLs that have watches, including the page ID, I just need a way to use this information to remove all watches from them.
Here's the SQL to gather the URLs that contain watches in our Controlled space:
SELECT um.username,
CONCAT ('https://www.ourjira.com/wiki/pages/viewpage.action?pageId=', c.contentId) AS URL,
c.title,
s.spacename,
c.contentID
FROM NOTIFICATIONS n,
user_mapping um,
SPACES s,
CONTENT c
WHERE n.contenttype = 'page'
AND n.contentID = c.contentID
AND um.user_key = n.username
AND c.spaceID = s.spaceID
AND s.spacename = 'Controlled';
This results in a table similar to the following:
watcher_username | page_url | page_title | page_space | page_id |
user1 | https://www.ourjira.com/wiki/pages/viewpage.action?pageId=205094967 | 01-06-2016 Sustainment WG Minutes | Controlled | 205094967 |
user2 | https://www.ourjira.com/wiki/pages/viewpage.action?pageId=204603402 | 01-06-2016 Sustainment WG Agenda | Controlled | 204603402 |
Hi @JET CM Folks You can remove watchers from a page by using DELETE method to REST API endpoint - /rest/api/user/watch/content/{contentId}
Please refer this link for the documentation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.