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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,460,398
Community Members
 
Community Events
176
Community Groups

Can I set multiple permissions in a single API call?

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 Jan 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

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

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 

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events