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

REST API call to get Confluence space permissions?

Philip Colmer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 6, 2019

I think the answer to this is no, but is there a REST API call I can make to retrieve the top-level space permissions for a given space?

I've been asked to tighten up our exit procedure so that spaces aren't left dying because there is nobody with admin access on a space after people leave.

Thanks.

 

4 answers

1 vote
Bert van Dijk _TMC_nl_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 12, 2023
This is an old thread, but what about the following Python script:
NOTE: it doesn't give you detailed information
import requests
import json
from atlassian import Confluence
 
# Change the following:
confluence_url = 'https://xxx.atlassian.net/'
username = 'user@company.com'
password = 'API token'
#########################
confluence = Confluence(url=confluence_url,username=username,password=password,cloud=True)
spaces = confluence.get_all_spaces(start=0, limit=500, expand=None)
for space in spaces["results"]:
    url = confluence_url+"/wiki/rest/api/space/"+space["key"]+"?expand=permissions"
    response = requests.get(url, auth=(username, password)).json()
    for permission in response["permissions"]:
        if "user" in permission["subjects"]:
            data = permission["subjects"]["user"]
            name = "publicName"
        else:
            data = permission["subjects"]["group"]
            name = "name"
        results = data["results"]
        for result in results:
            print(space["key"] + " - " +result[name])
1 vote
Diego
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 9, 2019

Hello, @Philip Colmer !
You are right on this matter. The REST API does not support the request you are looking for.
There are, in fact, some threads in our Developer Community about it. There they also proposed solutions to the situation. Take a look:

Let us hear from you, Philip! Looking forward to your reply.

Alexandre Emery March 5, 2020

Hey all,

Does anybody happen to know if this is still true as of today? /api/space/SPACE_KEY?expand=permissions works on a Confluence Cloud instance but not on my Confluence Server 7.1

Thanks

Like Ruslan Krivoshein likes this
Deleted user August 26, 2020

using 7.3.5, no its still not fixed. 

Apparently you need to write your own java plugin.

0 votes
Greg Fraser February 1, 2024

Not REST but it works - use JSON RPC (deprecated) API - https://developer.atlassian.com/server/confluence/remote-confluence-methods/#permissions

 

0 votes
Bernard March 21, 2022

Hi Philip,

Did you manage to retrieve the permission groups for a given space?  How did you solve this ?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events