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
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published 7 hours ago in Off-topic

Teams behind the teams - Your nominations please!

Teams do amazing things together. We’ve talked about the myth of the lone genius and how everything is actually the result of teamwork. You might be thinking, What about a novelist writing, say, Th...

50 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you