Class UserWatchResource
- java.lang.Object
-
- com.atlassian.confluence.plugins.restapi.resources.UserWatchResource
-
public class UserWatchResource extends Object
-
-
Constructor Summary
Constructors Constructor Description UserWatchResource(WatchService watchService, PersonService personService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ContentWatch
addContentWatcher(com.atlassian.sal.api.user.UserKey key, String username, ContentId contentId)
Create a new watcher for the given user and content id.SpaceWatch
addSpaceWatch(com.atlassian.sal.api.user.UserKey key, String username, List<ContentType> contentTypes, String spaceKey)
Create a new watcher for the given user and space key.javax.ws.rs.core.Response
isWatchingContent(com.atlassian.sal.api.user.UserKey key, String username, ContentId contentId)
Get information about whether a user is watching a specified content.javax.ws.rs.core.Response
isWatchingSpace(com.atlassian.sal.api.user.UserKey key, String username, ContentType contentType, String spaceKey)
Get information about whether a user is watching a specified space.javax.ws.rs.core.Response
removeContentWatcher(com.atlassian.sal.api.user.UserKey key, String username, ContentId contentId)
Delete an existing watcher for the given user and content id.javax.ws.rs.core.Response
removeSpaceWatch(com.atlassian.sal.api.user.UserKey key, String username, List<ContentType> contentTypes, String spaceKey)
Delete an existing watcher for the given user and space key.
-
-
-
Constructor Detail
-
UserWatchResource
public UserWatchResource(WatchService watchService, PersonService personService)
-
-
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 forusername
- userName of the user to create the new watcher forcontentTypes
- 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 forusername
- username of the user to delete the watcher forcontentTypes
- 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 stateusername
- username of the user to check for watching statecontentType
- 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 forusername
- 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 forusername
- 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 stateusername
- username of the user to check for watching state- Returns:
- true if the user is watching the content, false otherwise
- Throws:
ServiceException
-
-