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

How to add space permissions using Confluence API?

I want to add space permissions for a user/group using the Remote API. In the docs i found the function.

boolean addPermissionsToSpace(String token, Vector permissions, String remoteEntityName, String spaceKey) 
- Give the entity named remoteEntityName (either a group or a user) the permissions permissions on the space with the key spaceKey.

My problem is, i don't know what the JSON should look like for the function. The problem is, i don't know how to map the "Vector" Object to JSON.

I tried the following wihtout success.

1. [["EDITSPACE", "VIEWSPACE"], "confluence-users","SPMJ"] 
2. [[{"EDITSPACE", "VIEWSPACE"}], "confluence-users","SPMJ"]


Could someone please post an example?

I do a POST on following URL: 


3 answers

1 accepted

3 votes
Answer accepted

Actually, you can use the old remote APIs with simple JSON, that's why it's referred to as a JSON-RPC API.

This worked for me when I pasted it into the javascript console.  Don't forget you have to be logged in as administrator.

var requestArray = [];
var permissionsArray = [];
jQuery.ajax({dataType: 'json',
            contentType: 'application/json',
            type: 'POST',
            url: contextPath + '/rpc/json-rpc/confluenceservice-v2/addPermissionsToSpace',
            data: JSON.stringify(requestArray),
            success: function( data ) {

Thanks! Worked for me too.


This remote api is based on SOAP (WebService) protocol, you cannot use simple JSON.


Maybe it's better to use REST?


Regards, Mirko


"Peter Lustig" laugh

Sorry, i mean the REST-API, see

"Send POST requests to the Confluence API exposed via JSON-RPC at /rpc/json-rpc/confluenceservice-v2."

My only problem is, i don't know how to map "Vector" to JSON.

Can someone post an example, what the JSON must look like.

Yes, you are right! That was my mistake. Looks like Stephen posted the right answer.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in United States

Live! - Austin ACE -- Summer BASH 2019

Hey Austin! Come join us for our 2019 Atlassian Community Summer BASH as we transition ourselves into party status! Bring an attachment, log a great time, and collaborate with new friends as we celeb...

23 views 0 0
View post

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