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 ContentWatchaddContentWatcher(com.atlassian.sal.api.user.UserKey key, String username, ContentId contentId)Create a new watcher for the given user and content id.SpaceWatchaddSpaceWatch(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.ResponseisWatchingContent(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.ResponseisWatchingSpace(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.ResponseremoveContentWatcher(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.ResponseremoveSpaceWatch(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/SPACEKEYPOST http://example.com/confluence/rest/api/user/watch/space/SPACEKEY?username=jblogsPOST http://example.com/confluence/rest/api/user/watch/space/SPACEKEY?key=ff8080815a58e24c015a58e263710000POST 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 ServiceExceptionDelete 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/SPACEKEYDELETE http://example.com/confluence/rest/api/user/watch/space/SPACEKEY?username=jblogsDELETE http://example.com/confluence/rest/api/user/watch/space/SPACEKEY?key=ff8080815a58e24c015a58e263710000DELETE 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 ServiceExceptionGet 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/SPACEKEYhttp://example.com/confluence/rest/api/user/watch/space/SPACEKEY?username=jblogshttp://example.com/confluence/rest/api/user/watch/space/SPACEKEY?key=ff8080815a58e24c015a58e263710000http://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/131213POST http://example.com/confluence/rest/api/user/watch/content/131213?username=jblogsPOST 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 ServiceExceptionDelete 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/131213DELETE http://example.com/confluence/rest/api/user/watch/content/131213?username=jblogsDELETE 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 ServiceExceptionGet 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/131213http://example.com/confluence/rest/api/user/watch/content/131213?username=jblogshttp://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
-
-