It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

REST API Confluence get the Restriction and Permission per page

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

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.

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 

@Krause, 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,'

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,'

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

What project did you transition or start on Confluence with the shift to remote work?

It’s been great to hear from fellow users over the last few weeks about the best tips and fun moments you’ve had working on Confluence since the transition to working remote. I’d love to keep the c...

382 views 11 11
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you