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?
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()); }
When I try API on my confluence page, getting correct output for the same.
we need to check groovy code.
It looks like you're new here. Sign in or register to get started.