Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

REST API Confluence get the Restriction and Permission per page

KRAU212 July 21, 2017

Hey,

I wand receive a treeview of a space, which has the information of permissions and restrictions of groups and users.

At the moment, I use following REST-API-CALL to create the treeview of the space.

BASEURL /rest/api/space/{spacekey}/content/page?expand=content,ancestor

How I can expand this REST-API-CALL to receive the groups/users which are allowed to see the pages?

 

Thanks K

2 answers

2 votes
William Lupton December 12, 2019

@KRAU212, I just saw this and thought I'd share that you can do this via the "expand" query parameter. It took a few iterations to get it working (I found the reported possible expand values rather confusing)!

For example, this will get two levels of children and their restrictions. I too want to walk the entire tree, so I figured that I'd use a mixture of this and recursion.

expand = ''
expand += 'restrictions.read.restrictions.group,'
expand += 'restrictions.update.restrictions.group,'
expand += 'restrictions.read.restrictions.user,'
expand += 'restrictions.update.restrictions.user,'
expand += 'children.page.restrictions.read.restrictions.group,'
expand += 'children.page.restrictions.update.restrictions.group,'
expand += 'children.page.restrictions.read.restrictions.user,'
expand += 'children.page.restrictions.update.restrictions.user,'
expand += 'children.page.children.page.restrictions.read.restrictions' \
'.group,'
expand += 'children.page.children.page.restrictions.update.restrictions' \
'.group,'
expand += 'children.page.children.page.restrictions.read.restrictions' \
'.user,'
expand += 'children.page.children.page.restrictions.update.restrictions' \
'.user,'
William Lupton December 14, 2019

Update: I didn't notice that the URL in the original post was /rest/api/space/{spacekey}/content/page, so my suggestion to use "children.page" and "children.page.children.page" (etc.) won't have made sense (I was originally using the /rest/api/content?spaceKey=xxx URL).

However, this still works fine:

expand = ''
expand += 'restrictions.read.restrictions.group,'
expand += 'restrictions.update.restrictions.group,'
expand += 'restrictions.read.restrictions.user,'
expand += 'restrictions.update.restrictions.user,'
Like Peter McNeil likes this
1 vote
Junio Fernandes October 27, 2017

I think you cannot.

I'm trying something similar, but I have to perform another API call for each content id on BASEURL/rest/apí/content/{id}/restriction/byOperation.

gurgen2727 April 25, 2018

is there a way now  ? I need this , please help me ?

 

I need to remove all user permissions per page and only add permissions for specific users ? how to do that using REST API 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events