REST API - Space Permissions

REST API - Space Permissions

Available since v. 2.0.1

New REST APIs:

  • Get all space permission types

  • Get space groups with any permission

  • Get all spaces with permissions for the group

  • Add space permissions for the group

  • Remove all group permissions from space

  • Remove group permissions from space

Available since v. 2.1.0

New REST APIs:

  • Get space users with any permission

  • Get all spaces with permissions for the user

  • Add space permissions for the user

  • Remove all user permissions from space

  • Remove user permissions from space

Available since v. 2.2.0

New REST APIs:

  • Get user permissions for space

  • Get group permissions for space

  • Get spaces with anonymous permissions

  • Get all actors with permissions for space

Available since v. 3.1.*

New REST APIs:

  • Manage user space permissions (add and remove permissions with one call)

  • Manage group space permissions (add and remove permissions with one call)

Available since v. 3.16.*

Below REST APIs are now available to space administrators:

Available since v. 4.18.*

New REST APIs:

Available since v. 4.22.*

New REST API:


General

Get all space permission types

Available for all users

Method type: GET

URL: {CONFLUENCE_URL}/rest/extender/1.0/permission/space/permissionTypes

Response format: JSON

Example response:

[ "VIEWSPACE", "REMOVEOWNCONTENT", "COMMENT", "EDITSPACE", "SETSPACEPERMISSIONS", "REMOVEPAGE", "REMOVECOMMENT", "REMOVEBLOG", "CREATEATTACHMENT", "REMOVEATTACHMENT", "EDITBLOG", "EXPORTSPACE", "REMOVEMAIL", "SETPAGEPERMISSIONS" ]

Permission Name

Value

All - View

EXPORTPAGE
VIEWSPACE

Pages - Add

EDITSPACE

Pages - Restrict

SETPAGEPERMISSIONS

Pages - Delete

REMOVEPAGE

Blog - Add

EDITBLOG

Blog - Delete

REMOVEBLOG

Comments - Add

COMMENT

Comments - Delete

REMOVECOMMENT

Attachments - Add

CREATEATTACHMENT

Attachments - Delete

REMOVEATTACHMENT

Mail - Delete

REMOVEMAIL

Space - Export

EXPORTSPACE

Space - Admin

SETSPACEPERMISSIONS

Get spaces with anonymous permissions

Available only for Confluence Administrators

This API supports Pagination

This API supports optional parameters

Method type: GET

URL: {CONFLUENCE_URL}/rest/extender/1.0/permission/space/getSpacesWithAnonymousPermissions

Parameters:

  • creationDateFrom - filter spaces by created date (creation date >= this date)

  • creationDateTo - filter spaces by created date (creation date <= this date)

  • dateFormat - define date format for parameters creationDateFrom, creationDateTo and for JSON output fields creationDateString, lastModificationDateString - default format ‘yyyy-MM-dd'

Example URL:

  • {CONFLUENCE_URL}/rest/extender/1.0/permission/space/getSpacesWithAnonymousPermissions?creationDateTo=2020-05-14

  • {CONFLUENCE_URL}/rest/extender/1.0/permission/space/getSpacesWithAnonymousPermissions?creationDateFrom=12/01/2019&dateFormat=MM/dd/yyyy

  • {CONFLUENCE_URL}/rest/extender/1.0/permission/space/getSpacesWithAnonymousPermissions?creationDateTo=03.01.2020&creationDateFrom=01.01.2020&dateFormat=MM.dd.yyyy

Response format: JSON

Example response:

{ "total": 2, "maxResults": 100, "spaces": { "SPACEA": { "creationDateString": "05-14-2020 14:53:21", "lastModificationDate": 1589460802858, "permissions": [ "VIEWSPACE" ], "lastModificationDateString": "05-14-2020 14:53:22", "creatorName": "admin", "name": "Space A", "creationDate": 1589460801648, "key": "SPACEA" }, "ds": { "creationDateString": "09-25-2018 11:05:32", "lastModificationDate": 1573637171250, "permissions": [ "VIEWSPACE", "REMOVEOWNCONTENT", "COMMENT", "EDITSPACE", "REMOVEPAGE", "REMOVECOMMENT", "REMOVEBLOG", "CREATEATTACHMENT", "REMOVEATTACHMENT", "EDITBLOG", "EXPORTSPACE", "REMOVEMAIL" ], "lastModificationDateString": "11-13-2019 10:26:11", "creatorName": "not exist", "name": "Demonstration Space", "creationDate": 1537866332331, "key": "ds" } }, "startAt": 0 }

 


Get all actors with permissions for space

Available only for Confluence Administrators and Space Administrators

Method type: GET

URL: {CONFLUENCE_URL}/rest/extender/1.0/permission/space/{SPACE_KEY}/getSpacePermissionActors/{PERMISSION_TYPE}

Example URL:

  • {CONFLUENCE_URL}/rest/extender/1.0/permission/space/DEMO/getSpacePermissionActors/ALL

  • {CONFLUENCE_URL}/rest/extender/1.0/permission/space/DEMO/getSpacePermissionActors/REMOVEPAGE

Response format: JSON

Example response:

{ "permissions": { "EDITSPACE": { "anonymousAccess": true, "groups": [ "confluence-users" ] }, "SETSPACEPERMISSIONS": { "anonymousAccess": false, "groups": [ "confluence-administrators" ], "users": [ "admin", "john" ] }, "REMOVEMAIL": { "anonymousAccess": true, "groups": [ "confluence-administrators", "confluence-users" ] } }, "name": "Demonstration Space", "key": "ds" }

 


Override all content permissions for space

Available only for Confluence Administrators and Space Administrators

Method type: PUT

URL: {CONFLUENCE_URL}/rest/extender/1.0/permission/space/{SPACE_KEY}/content/overrideAllContentPermissions

  • where {SPACE_KEY} is the space key

Example URL:

  • {CONFLUENCE_URL}/rest/extender/1.0/permission/space/KB/content/overrideAllContentPermissions

Request format: JSON

Example request: #1

{ "permissions":[ { "userName": "admin", "permissionTypes": ["edit", "view"] } ] }

Example request: #2

{ "permissions":[ { "userName": "product-owner", "permissionTypes": ["edit"] }, { "userName": "user", "permissionTypes": ["view"] }, { "userName": "admin", "permissionTypes": ["edit", "view"] }, { "groupName": "confluence-users", "permissionTypes": ["view"] }, { "groupName": "confluence-admins", "permissionTypes": ["view", "edit"] } ] }

Response format: JSON

Example response:

{ "overrideBlogPosts": false, "totalPages": 11, "totalBlogPosts": 0, "overridePages": true }

 


Anonymous

Get anonymous permissions for space

Available only for Confluence Administrators or Space Administrator

Method type: GET GET

URL: {CONFLUENCE_URL}/rest/extender/1.0/permission/anonymous/getPermissionsForSpace/space/{SPACE_KEY}

  • where {SPACE_KEY} is the space key

Response format: JSON

Example response:

{ "permissions": [ "VIEWSPACE", "REMOVEOWNCONTENT", "COMMENT", "EDITSPACE", "SETSPACEPERMISSIONS", "REMOVEPAGE", "REMOVECOMMENT" ], "name": "Demonstration Space", "key": "ds" }

 


Manage anonymous space permissions (add and remove permissions with one call)

Available only for Confluence Administrators or Space Administrator

Method type: PUT

URL: {CONFLUENCE_URL}/rest/extender/1.0/permission/space/{SPACE_KEY}/anonymous/manageSpacePermissions

  • where {SPACE_KEY} is the space key

Request format: JSON

Example request: Permissions to add

{ "addPermissions":[ "VIEWSPACE", "COMMENT" ], "removePermissions":[ "REMOVEMAIL", "SETPAGEPERMISSIONS" ] }

Response format: JSON

Example response:

{ "addedPermissions": [ "VIEWSPACE", "COMMENT" ], "removedPermissions":[ "REMOVEMAIL", "SETPAGEPERMISSIONS" ] }

 


Add space permissions for anonymous

Available only for Confluence Administrators or Space Administrator

Method type: PUT

URL: {CONFLUENCE_URL}/rest/extender/1.0/permission/space/{SPACE_KEY}/anonymous/addSpacePermissions

  • where {SPACE_KEY} is the space key

Request format: JSON

Example request: Permissions to add

{ "permissions":[ "VIEWSPACE", "COMMENT" ] }

Response format: JSON

Example response:

{ "total": 2, "added": [ "VIEWSPACE", "COMMENT" ], "skipped": [] }

 


Remove all anonymous permissions from space

Available only for Confluence Administrators or Space Administrator

Method type: DELETE

URL: {CONFLUENCE_URL}/rest/extender/1.0/permission/space/{SPACE_KEY}/anonymous/removeAllSpacePermissions

  • where {SPACE_KEY} is the space key

Response format: JSON

Example response:

{ "total": 2, "removed": [ "VIEWSPACE", "COMMENT" ] }

 


Remove anonymous permissions from space

Available only for Confluence Administrators or Space Administrator

Method type: DELETE

URL: {CONFLUENCE_URL}/rest/extender/1.0/permission/space/{SPACE_KEY}/anonymous/removeSpacePermissions

  • where {SPACE_KEY} is the space key

Request format: JSON

Example request: Permissions to add

{ "permissions":[ "VIEWSPACE", "COMMENT" ] }

Response format: JSON

Example response:

{ "total": 2, "removed": [ "VIEWSPACE", "COMMENT" ] }

 


 

 

Users

Get space users with any permission

Available only for Confluence Administrators or Space Administrator

Method type: GET GET

URL: {CONFLUENCE_URL}/rest/extender/1.0/permission/space/{SPACE_KEY}/allUsersWithAnyPermission

  • where {SPACE_KEY} is the space key

Response format: JSON

Example response:

{ "total": 2, "maxResults": 1000, "users": [ "admin", "john" ], "startAt": 0 }

 


Get user permissions for space

Available only for Confluence Administrators or Space Administrator

Method type: GET GET

URL: {CONFLUENCE_URL}/rest/extender/1.0/permission/user/{USER_NAME}/getPermissionsForSpace/space/{SPACE_KEY}

  • where {USER_NAME} is the user name

  • where {SPACE_KEY} is the space key

Response format: JSON

Example response:

{ "permissions": [ "VIEWSPACE", "REMOVEOWNCONTENT", "COMMENT", "EDITSPACE", "SETSPACEPERMISSIONS", "REMOVEPAGE", "REMOVECOMMENT" ], "name": "Demonstration Space", "key": "ds" }

 


Get all spaces with permissions for the user

Available only for Confluence Administrators

Method type: GET

URL: {CONFLUENCE_URL}/rest/extender/1.0/permission/user/{USER_NAME}/getAllSpacesWithPermissions

  • where {USER_NAME} is the user name

Parameters:

  • spacesAsArray - change ‘spaces’ parameter in response from HashMap to Array (Available since v. 2.4.0)

  • This API supports Pagination

Example URL:

  • {CONFLUENCE_URL}/rest/extender/1.0/permission/user/{USER_NAME}/getAllSpacesWithPermissions?spacesAsArray=true

  • {CONFLUENCE_URL}/rest/extender/1.0/permission/user/{USER_NAME}/getAllSpacesWithPermissions?spacesAsArray=true&startAt=100

Response format: JSON

Example response:

Without spacesAsArray

{ "total": 2, "maxResults": 100, "spaces": { "KB": { "permissions": [ "VIEWSPACE", "SETSPACEPERMISSIONS", "EXPORTSPACE" ], "name": "knowledge base", "key": "KB" }, "TEAMSP": { "permissions": [ "VIEWSPACE", "COMMENT", "EDITSPACE", "CREATEATTACHMENT", "EDITBLOG" ], "name": "Team Space", "key": "TEAMSP" } }, "startAt": 0 }

 

With spacesAsArray

{ "total": 2, "maxResults": 100, "spaces": { "KB": { "permissions": [ "VIEWSPACE", "SETSPACEPERMISSIONS", "EXPORTSPACE" ], "name": "knowledge base", "key": "KB" }, "TEAMSP": { "permissions": [ "VIEWSPACE", "COMMENT", "EDITSPACE", "CREATEATTACHMENT", "EDITBLOG" ], "name": "Team Space", "key": "TEAMSP" } }, "startAt": 0 }

 

 


Manage user space permissions (add and remove permissions with one call)

Available only for Confluence Administrators or Space Administrator

Method type: PUT

URL: {CONFLUENCE_URL}/rest/extender/1.0/permission/space/{SPACE_KEY}/user/{USER_NAME}/manageSpacePermissions

  • where {USER_NAME} is the user name

  • where {SPACE_KEY} is the space key

Request format: JSON

Example request: Permissions to add

{ "addPermissions":[ "VIEWSPACE", "COMMENT" ], "removePermissions":[ "REMOVEMAIL", "SETPAGEPERMISSIONS" ] }

Response format: JSON

Example response:

{ "addedPermissions": [ "VIEWSPACE", "COMMENT" ], "removedPermissions":[ "REMOVEMAIL", "SETPAGEPERMISSIONS" ] }

 


Add space permissions for the user

Available only for Confluence Administrators or Space Administrator

Method type: PUT

URL: {CONFLUENCE_URL}/rest/extender/1.0/permission/space/{SPACE_KEY}/user/{USER_NAME}/addSpacePermissions

  • where {USER_NAME} is the user name

  • where {SPACE_KEY} is the space key

Request format: JSON

Example request: Permissions to add

{ "permissions":[ "VIEWSPACE", "COMMENT" ] }

Response format: JSON

Example response:

{ "total": 2, "added": [ "VIEWSPACE", "COMMENT" ], "skipped": [] }

 


Remove all user permissions from space

Available only for Confluence Administrators or Space Administrator

Method type: DELETE

URL: {CONFLUENCE_URL}/rest/extender/1.0/permission/space/{SPACE_KEY}/user/{USER_NAME}/removeAllSpacePermissions

  • where {USER_NAME} is the user name

  • where {SPACE_KEY} is the space key

Response format: JSON

Example response:

{ "total": 5, "removed": [ "VIEWSPACE", "CREATEATTACHMENT", "EDITBLOG", "COMMENT", "EDITSPACE" ] }

 


Remove user permissions from space

Available only for Confluence Administrators or Space Administrator

Method type: DELETE

URL: {CONFLUENCE_URL}/rest/extender/1.0/permission/space/{SPACE_KEY}/user/{USER_NAME}/removeSpacePermissions

  • where {USER_NAME} is the user name

  • where {SPACE_KEY} is the space key

Request format: JSON

Example request: Permissions to add

{ "permissions":[ "VIEWSPACE", "COMMENT" ] }

Response format: JSON

Example response:

{ "total": 2, "removed": [ "VIEWSPACE", "COMMENT" ] }

 

 

Groups

Get space groups with any permission

Available only for Confluence Administrators or Space Administrator

This API supports Pagination

Method type: GET GET

URL: {CONFLUENCE_URL}/rest/extender/1.0/permission/space/{SPACE_KEY}/allGroupsWithAnyPermission

  • where {SPACE_KEY} is the space key

Response format: JSON

Example response:

{ "total": 2, "maxResults": 1000, "groups": [ "confluence-administrators", "confluence-users" ], "startAt": 0 }

 


Get group permissions for space

Available only for Confluence Administrators or Space Administrator

Method type: GET GET

URL: {CONFLUENCE_URL}/rest/extender/1.0/permission/group/{GROUP_NAME}/getPermissionsForSpace/space/{SPACE_KEY}

  • where {GROUP_NAME} is the name of the group

  • where {SPACE_KEY} is the space key

Response format: JSON

Example response:

{ "permissions": [ "VIEWSPACE", "REMOVEOWNCONTENT", "COMMENT", "EDITSPACE", "SETSPACEPERMISSIONS", "REMOVEPAGE", "REMOVECOMMENT" ], "name": "Demonstration Space", "key": "ds" }

 


the Get all spaces with permissions for group

Available only for Confluence Administrators

Method type: GET

URL: {CONFLUENCE_URL}/rest/extender/1.0/permission/group/{GROUP_NAME}/getAllSpacesWithPermissions

  • where {GROUP_NAME} is the name of the group

Parameters:

  • spacesAsArray - change ‘spaces’ parameter in response from HashMap to Array (Available since v. 2.4.0)

  • This API supports Pagination

Example URL:

  • {CONFLUENCE_URL}/rest/extender/1.0/permission/group/{GROUP_NAME}/getAllSpacesWithPermissions?spacesAsArray=true

  • {CONFLUENCE_URL}/rest/extender/1.0/permission/group/{GROUP_NAME}/getAllSpacesWithPermissions?spacesAsArray=true&startAt=100

Response format: JSON

Example response:

Without spacesAsArray