Class UserWatchResource


  • public class UserWatchResource
    extends Object
    A REST resource for manipulating watchers for Spaces, pieces of Content and Labels.
    • Method Detail

      • addSpaceWatch

        @PublicApi
        public SpaceWatch addSpaceWatch​(com.atlassian.sal.api.user.UserKey key,
                                        String username,
                                        List<ContentType> contentTypes,
                                        String spaceKey)
                                 throws ServiceException

        Create a new watcher for the given user and space key.

        User is optional. If not specified, currently logged-in user will be used. Otherwise, it can be specified by either user key or username. When a user is specified and is different from the logged-in user, the logged-in user needs to be a Confluence administrator.

        Example request URI(s):

        • POST http://example.com/confluence/rest/api/user/watch/space/SPACEKEY
        • POST http://example.com/confluence/rest/api/user/watch/space/SPACEKEY?username=jblogs
        • POST http://example.com/confluence/rest/api/user/watch/space/SPACEKEY?key=ff8080815a58e24c015a58e263710000
        • POST http://example.com/confluence/rest/api/user/watch/space/SPACEKEY?contentType=blogpost
        Parameters:
        key - userKey of the user to create the new watcher for
        username - userName of the user to create the new watcher for
        contentTypes - the optional content type to delete the watcher for
        Throws:
        ServiceException
      • removeSpaceWatch

        @PublicApi
        public javax.ws.rs.core.Response removeSpaceWatch​(com.atlassian.sal.api.user.UserKey key,
                                                          String username,
                                                          List<ContentType> contentTypes,
                                                          String spaceKey)
                                                   throws ServiceException

        Delete an existing watcher for the given user and space key.

        User is optional. If not specified, currently logged-in user will be used. Otherwise, it can be specified by either user key or username. When a user is specified and is different from the logged-in user, the logged-in user needs to be a Confluence administrator.

        Example request URI(s):

        • DELETE http://example.com/confluence/rest/api/user/watch/space/SPACEKEY
        • DELETE http://example.com/confluence/rest/api/user/watch/space/SPACEKEY?username=jblogs
        • DELETE http://example.com/confluence/rest/api/user/watch/space/SPACEKEY?key=ff8080815a58e24c015a58e263710000
        • DELETE http://example.com/confluence/rest/api/user/watch/space/SPACEKEY?contentType=blogpost
        Parameters:
        key - userkey of the user to delete the watcher for
        username - username of the user to delete the watcher for
        contentTypes - the optional content type to delete the watcher for
        Throws:
        ServiceException
      • isWatchingSpace

        @PublicApi
        public javax.ws.rs.core.Response isWatchingSpace​(com.atlassian.sal.api.user.UserKey key,
                                                         String username,
                                                         ContentType contentType,
                                                         String spaceKey)
                                                  throws ServiceException

        Get information about whether a user is watching a specified space.

        User is optional. If not specified, currently logged-in user will be used. Otherwise, it can be specified by either user key or username. When a user is specified and is different from the logged-in user, the logged-in user needs to be a Confluence administrator.

        Example request URI(s):

        • http://example.com/confluence/rest/api/user/watch/space/SPACEKEY
        • http://example.com/confluence/rest/api/user/watch/space/SPACEKEY?username=jblogs
        • http://example.com/confluence/rest/api/user/watch/space/SPACEKEY?key=ff8080815a58e24c015a58e263710000
        • http://example.com/confluence/rest/api/user/watch/space/SPACEKEY?contentType=blostpost
        Parameters:
        key - userkey of the user to check for watching state
        username - username of the user to check for watching state
        contentType - an optional content type to check for watching state
        Returns:
        true if the user is watching the space, false otherwise
        Throws:
        ServiceException
      • addContentWatcher

        @PublicApi
        public ContentWatch addContentWatcher​(com.atlassian.sal.api.user.UserKey key,
                                              String username,
                                              ContentId contentId)
                                       throws ServiceException

        Create a new watcher for the given user and content id.

        User is optional. If not specified, currently logged-in user will be used. Otherwise, it can be specified by either user key or username. When a user is specified and is different from the logged-in user, the logged-in user needs to be a Confluence administrator.

        Example request URI(s):

        • POST http://example.com/confluence/rest/api/user/watch/content/131213
        • POST http://example.com/confluence/rest/api/user/watch/content/131213?username=jblogs
        • POST http://example.com/confluence/rest/api/user/watch/content/131213?key=ff8080815a58e24c015a58e263710000
        Parameters:
        key - userkey of the user to create the new watcher for
        username - username of the user to create the new watcher for
        Throws:
        ServiceException
      • removeContentWatcher

        @PublicApi
        public javax.ws.rs.core.Response removeContentWatcher​(com.atlassian.sal.api.user.UserKey key,
                                                              String username,
                                                              ContentId contentId)
                                                       throws ServiceException

        Delete an existing watcher for the given user and content id.

        User is optional. If not specified, currently logged-in user will be used. Otherwise, it can be specified by either user key or username. When a user is specified and is different from the logged-in user, the logged-in user needs to be a Confluence administrator.

        Example request URI(s):

        • DELETE http://example.com/confluence/rest/api/user/watch/content/131213
        • DELETE http://example.com/confluence/rest/api/user/watch/content/131213?username=jblogs
        • DELETE http://example.com/confluence/rest/api/user/watch/content/131213?key=ff8080815a58e24c015a58e263710000
        Parameters:
        key - userkey of the user to delete the watcher for
        username - username of the user to delete the watcher for
        Throws:
        ServiceException
      • isWatchingContent

        @PublicApi
        public javax.ws.rs.core.Response isWatchingContent​(com.atlassian.sal.api.user.UserKey key,
                                                           String username,
                                                           ContentId contentId)
                                                    throws ServiceException

        Get information about whether a user is watching a specified content.

        User is optional. If not specified, currently logged-in user will be used. Otherwise, it can be specified by either user key or username. When a user is specified and is different from the logged-in user, the logged-in user needs to be a Confluence administrator.

        Example request URI(s):

        • http://example.com/confluence/rest/api/user/watch/content/131213
        • http://example.com/confluence/rest/api/user/watch/content/131213?username=jblogs
        • http://example.com/confluence/rest/api/user/watch/content/131213?key=ff8080815a58e24c015a58e263710000
        Parameters:
        key - userkey of the user to check for watching state
        username - username of the user to check for watching state
        Returns:
        true if the user is watching the content, false otherwise
        Throws:
        ServiceException