I want to find a confluence server java api for getting watchers of a page.
But I can't find anything useful for doing this in https://docs.atlassian.com/atlassian-confluence/6.6.0/.
And alse there is no this api in confluence server rest api.
And I don't want use this link:${base_url}/json/listwatchers.action?pageId=${page_id}.
So is there a java api for getting watchers of a page?
Thanks in advanced.
Hi @br0wse ,
Welcome to Atlassian Community!
You can get list of watchers for particular page using below rest api
<your confluence url>/json/listwatchers.action?pageId=<pageId>
Please try and confirm.
Thanks,
Prashant
Hi @Prashant Mali,
I know this rest api "<your confluence url>/json/listwatchers.action?pageId=<pageId>".
But when I use groovy httpbuidler,it always return null. My code is just like below:
def a=new HTTPBuilder("http://example.confluence.com:8090")
a.setHeaders([Authorization:"Basic ${"admin:admin".bytes.encodeBase64().toString()}",Accept:"application/json"])
//a.auth.basic 'admin','admin'
def b=a.get(path:"/json/listwatchers.action?pageId=2261002")
Could you please show me a example code?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @br0wse ,
Please have a look on below code. and try to get business logic from the same.
Set<ConfluenceUser> users = new HashSet<>(); // Get users from page watches for (Notification notification : notificationManager.getNotificationsByContent(pageCeo)) { users.add(notification.getReceiver()); } // Get users from space watches for (Notification notification : notificationManager.getNotificationsBySpaceAndType(space, null)) { users.add(notification.getReceiver()); }
Thanks,
Prashant
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @br0wse ,
When I try API on my confluence page, getting correct output for the same.
we need to check groovy code.
Thanks,
Prashant
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.