Hi community,
Can anyone please share a code snippet for a confluence REST EndPoint that adds a given user as a watcher on a given page/content?
I've been struggling with the existing documentation and API but couldn't get to a solution...
Any contribution would be welcomed!
Thanks a lot,
Tanya
Answering to myself :-)
For string parameters: user, pageId
import com.atlassian.confluence.mail.notification.NotificationManager
import bucket.user.UserAccessor
import com.atlassian.confluence.pages.Page
import com.atlassian.confluence.pages.PageManager
def notificationManager = (NotificationManager) ContainerManager.getComponent('notificationManager')
def userName = userAccessor.getUser(user)
Page page = pageManager.getPage(pageId)
def content = page?.getContentEntityObject()
notificationManager.addContentNotification(userName, content)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.