Setting Multiple Permissions

The POST method assigns any number of permissions to any number of resources specified in the body of the request. All permissions must be newly assigned, and the request will fail if a recipient already has an assigned (not inherited) permission. Use the PUT method to update assigned permissions.

Method

URL

POST

http://<host>:<port>/jasperserver[-pro]/rest_v2/permissions

Content-Type

Content

application/collection+json

A JSON object that describes a set of permissions, for example:

{
  "permission" :[
    {
    "uri":"/properties",
    "recipient":"role:ROLE_USER",
    "mask":"1"
    },
    {
    "uri":"/properties",
    "recipient":"role:ROLE_ADMINISTRATOR",
    "mask":"32"
    }
]}

Return Value on Success

Typical Return Values on Failure

201 Created – The request was successful.

400 Bad Request – A permission is already assigned or the given permission mask is invalid.

The PUT method modifies exiting permissions (already assigned).

Method

URL

PUT

http://<host>:<port>/jasperserver[-pro]/rest_v2/permissions/path/to/resource

Content-Type

Content

application/collection+json

A JSON object that describes a set of permissions. Because a single resource is specified in the URL, all permissions apply to the same resource, and the server ignores the uri field in the JSON object.

{
  "permission" :[
    {
    "uri":"/foo",
    "recipient":"role:ROLE_MANAGER|organization_1",
    "mask":"30"
    },
    {
    "uri":"/bar",
    "recipient":"user:joeuser|organization_1",
    "mask":"32"
    }
]}

Return Value on Success

Typical Return Values on Failure

200 OK – The request was successful.

400 Bad Request – If a recipient or mask is invalid.

404 Not Found – If the resource in the URL is invalid.

Feedback
randomness