How to get list of space and page watches for a user
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
Purpose
To get all the space and page watches of a user from the database.
Solution
The following queries have been tested in PostGreSQL
Get Page Watches - Replace <user_name> with actual username
1
2
3
4
5
6
7
8
9
SELECT c.contentid, c.title, s.spacekey
FROM CONTENT c
JOIN SPACES s
ON c.spaceid = s.spaceid
JOIN NOTIFICATIONS n
ON c.contentid = n.contentid
JOIN user_mapping um
ON n.username = um.user_key
WHERE um.username = '<user_name>';
Get Space Watches - Replace <user_name> with actual username
1
2
3
4
5
6
7
SELECT s.spaceid, s.spacekey, s.spacename
FROM SPACES s
JOIN NOTIFICATIONS n
ON s.spaceid = n.spaceid
JOIN user_mapping um
ON n.username = um.user_key
WHERE um.username = '<user_name>';
Was this helpful?