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:
https://{confluenceURL}/rpc/json-rpc/confluenceservice-v2/addPermissionsToSpace
Community moderators have prevented the ability to post new answers.
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 = []; permissionsArray.push("VIEWSPACE"); permissionsArray.push("EDITSPACE"); requestArray.push(permissionsArray); requestArray.push("confluence-users"); requestArray.push("SPMJ"); jQuery.ajax({dataType: 'json', contentType: 'application/json', type: 'POST', url: contextPath + '/rpc/json-rpc/confluenceservice-v2/addPermissionsToSpace', data: JSON.stringify(requestArray), success: function( data ) { console.log(data); } });
How are the other parameters called (e.g. DELETE OWN, DELETE PAGE, etc..)
EDIT:
So far I've found out the following:
"VIEWSPACE",
"EDITSPACE",
"REMOVEPAGE",
"EDITBLOG",
"REMOVEBLOG",
"COMMENT",
"REMOVECOMMENT",
"CREATEATTACHMENT",
"REMOVEATTACHMENT",
"REMOVEMAIL",
"REMOVEOWNCONTENT",
"EXPORTSPACE",
"SETPAGEPERMISSIONS",
"REMOVEPAGE"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi!
This remote api is based on SOAP (WebService) protocol, you cannot use simple JSON.
https://developer.atlassian.com/confdev/confluence-rest-api/confluence-xml-rpc-and-soap-apis
Maybe it's better to use REST?
https://developer.atlassian.com/confdev/confluence-rest-api
Regards, Mirko
"Peter Lustig"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, i mean the REST-API, see https://developer.atlassian.com/confdev/confluence-rest-api/confluence-json-rpc-apis.
"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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, you are right! That was my mistake. Looks like Stephen posted the right answer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.