Skip to content
atlassian-dc-mcp
Esc
↑↓navigate↵open⌘Jpreview

Update restrictions

Sets all the restrictions specified to a piece of content identified by contentId. Setting per-content restrictions is currently allowed for Pages or BlogPosts only.

Example request URI:

http://example.com/confluence/rest/content/1234567/restriction?expand=

The payload uses the same schema as returned by the GET requests from /rest/api/content/{id}/restriction/byOperation* which can be used as a template but is not necessary.

Example request for a single content restriction:

[ { "operation": "update", "restrictions": { "user": [ { "type": "known", "username": "admin" } ] } } ]

Example request for updating two ContentRestrictions:

[ { "operation": "update", "restrictions": { "user": [ { "type": "known", "username": "admin" } ] } }, { "operation": "read", "restrictions": { "user": [ { "type": "known", "username": "fred" } ] } } ]

Rules for using this method:

  • The provided ContentRestrictions will overwrite any existing restrictions on the Content for the corresponding operations.
  • If the provided ContentRestriction lacks any supported operations, the restrictions for the operations will not be altered.
  • Setting users and/or groups map entries as empty arrays will remove the corresponding content restrictions.
  • Missing users and/or groups map entries means the corresponding operation’s user/group content restrictions won’t be changed.
  • Modifying restrictions to revoke the requesting user’s access is prohibited.
PUT/rest/api/content/{id}/restriction
Path parameters
idstringrequired

The id of the content

Query parameters
expandstring

A comma separated list of properties to expand in the response. Default is <code>restrictions.user, restrictions.group</code> Default value: group.

limitstring

pagination limit.

startstring

pagination start.

Request body
application/json
Array of ContentRestriction
contentReferenceContent
Show properties
expandedboolean
idPropertiesobject
operationstring
restrictionsobject
Responses
200

Returns a full JSON representation of the restrictions present directly on piece of content after the update operation.

resultsOperationRestriction[]
Show properties
Array of OperationRestriction
operationstring

The operation type

restrictionsRestrictions
Show properties
userPageResponseObject
Show properties
resultsobject[]

Results of the page response

startinteger<int32>

Start index of the page response

limitinteger<int32>

Limit of the page response

sizeinteger<int32>

Size of the results

groupPageResponseObject
Show properties
resultsobject[]

Results of the page response

startinteger<int32>

Start index of the page response

limitinteger<int32>

Limit of the page response

sizeinteger<int32>

Size of the results

get_linksLinks
Show properties
selfstring

Self link

basestring

Base link

contextstring

Context link

get_expandableExpandable
Show properties
contentstring

Content link

startnumber
limitnumber
sizenumber
_linksobject
Show properties
basestring
selfstring
contextstring
nextstring
prevstring
400

Returned if any of the above validation rules are violated.

statusCodeinteger<int32>
dataValidationResult
Show properties
authorizedboolean
validboolean
errorsobject
successfulboolean
allowedInReadOnlyModeboolean
messagestring
reasonstring
401

Returned if the calling user is not authenticated.

statusCodeinteger<int32>
dataValidationResult
Show properties
authorizedboolean
validboolean
errorsobject
successfulboolean
allowedInReadOnlyModeboolean
messagestring
reasonstring
403

Returned if the calling user does not have permission to edit the restrictions.

statusCodeinteger<int32>
dataValidationResult
Show properties
authorizedboolean
validboolean
errorsobject
successfulboolean
allowedInReadOnlyModeboolean
messagestring
reasonstring
404

Returned if there is no content with the given id, or if the calling user does not have permission to view the content.

statusCodeinteger<int32>
dataValidationResult
Show properties
authorizedboolean
validboolean
errorsobject
successfulboolean
allowedInReadOnlyModeboolean
messagestring
reasonstring
Try it
Server
Parameters
Bodyapplication/json
Request
curl -X PUT 'http://example.com:7990/confluence/rest/api/content/string/restriction' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '[
  {
    "content": {
      "expanded": true,
      "idProperties": {}
    },
    "operation": "string",
    "restrictions": {}
  }
]'
Response
{
  "results": [
    {
      "operation": "read",
      "restrictions": {
        "user": {
          "results": [],
          "start": 0,
          "limit": 200,
          "size": 0
        },
        "group": {
          "results": [],
          "start": 0,
          "limit": 200,
          "size": 0
        }
      },
      "get_links": {
        "self": "https://instenv-320828-cq6e.instenv.internal.atlassian.com/rest/api/content/2326529/restriction/byOperation/read",
        "base": "https://instenv-320828-cq6e.instenv.internal.atlassian.com",
        "context": "string"
      },
      "get_expandable": {
        "content": "/rest/api/content/2326529"
      }
    }
  ],
  "start": 25,
  "limit": 25,
  "size": 25,
  "_links": {
    "base": "http://localhost:8085/rest/api",
    "self": "http://localhost:8085/rest/api",
    "context": "http://localhost:8085/rest/api",
    "next": "http://localhost:8085/rest/api/latest/../paginate?limit=25&start=50",
    "prev": "http://localhost:8085/rest/api/latest/../paginate?limit=25&start=0"
  }
}

Was this page helpful?