Can I set multiple permissions in a single API call?

Nicholas Shaw December 3, 2021

I am attempting to set permissions for spaces, and want to use a single API call to set all the permissions I want at once.

Space Permission API 

Whenever I try building my payload though, only one permission is set, and it's always the last permission in the list.

I've tried both the below method, and just using multiple operation objects, and both have the same problem.

I could of course use a single call per permission, but I have hundreds of spaces, and want to set 3-5 permissions per space, that's a *ton* of calls. 

Here's the python I've got:

  payload = json.dumps({

    "subject": {

      "identifier": <GroupID>,

      "type": "group"

    },

    "operation": {

      "key": "read",

      "target": "space",

      "key": "delete",

      "target": "space",

      "key": "create",

      "target": "comment",

      "key": "create",

      "target": "attachment"

    },

    "_links": {}

  })

  response = requests.request("POST", url, headers=ConfluenceVars.headers, data=payload, verify=False)

2 answers

1 accepted

0 votes
Answer accepted
Pramodh M
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 23, 2022

Hi @Nicholas Shaw 

It's only one permission as per the documentation

Space.png

in this doc

https://developer.atlassian.com/cloud/confluence/rest/api-group-space-permissions/#api-wiki-rest-api-space-spacekey-permission-post

Call multiple API to set multiple permissions for either user or a group

Thanks,
Pramodh

Derek Adkins March 21, 2022

"At least one" implies that I can send more than one if I wanted to.

Like Nadim96 likes this
0 votes
Sharang Shrivastava July 27, 2022

You can not set multiple keys with same string in dictionary object , it will overwrite and use only one unique. In order to send multiple operation calls in one , just pass multiple operation dictionary object in the same call using "list of dictionary". Please refer below.

 

operations": [ { "key": "read", "target": "page"},

                      { "key": "create", "target": "page"}

                    ]

Same has been described in the docs also , although you need to use different endpoint also.

Add new custom content permission to space 

michali_tsompanoglou
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 5, 2023

This doesn't work right?

Nadim96
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 18, 2024

don't think this works, any update?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events