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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

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

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 

Suggest an answer

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

What do you think is the most *delightful* Confluence feature? Comment for a prize!

- Create your own custom emoji 🔥 - "Shake for Feedback" on mobile 📱 - An endless supply of GIFs via GIPHY 🤩 Is there anything quite as nice as a pleasant surprise? Comment below with what...

480 views 24 9
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