Method for Working with Administrator Account Access Permissions

To work with administrator account access permissions, execute requests using the "permissions" API method (determine user token before executing the request):

curl -v '<IP address or DNS server name>/api/v2/permissions/codes/' --header 'Content-Type: application/json' -H 'Authorization: Bearer <administrator token>'

The example of response:

["ADMINISTRATION","SYSTEM_LOGS","MOBILE_APPS","ENVIRONMENTS","PROJECT","ENVIRONMENT"]

curl -v '<IP address or DNS server name>/api/v2/permissions/types/' --header 'Content-Type: application/json' -H 'Authorization: Bearer <administrator token>'

The example of response:

{"R":"Read-only","W":"Full access","RC":"Read cache"}

curl -v '<IP address or DNS server name>/api/v2/permissions/enums/' --header 'Content-Type: application/json' -H 'Authorization: Bearer <administrator token>'

The example of response:

{"PROJECT":["R","RC","W"],"ENVIRONMENT":["RC","W","R"],"ENVIRONMENTS":["W","RC","R"],"MOBILE_APPS":["R","W"],"ADMINISTRATION":["R","W"],"SYSTEM_LOGS":["R"]}

curl -X POST '<IP address or DNS server name>/api/v2/permissions/' --header 'Content-Type: application/json' -H 'Authorization: Bearer <administrator token>' -d '{
    "user": <administrator identifier>,
    "p_code": "<access permissions code>",
    "p_types": [
        "<access permissions type>"
    ],
    "object_pk": <identifier of access object, specific environment, or project>
}'

In the <administrator identifier> substitution use value of the id parameter returned on getting the list of all administrator accounts.

The example of response:

{
    "id": 4,
    "user": 5,
    "p_code": "ENVIRONMENT",
    "p_types": [
        "R",
        "W"
    ],
    "object_pk": 2,
    "human_readable": "Access to the "environment" environment"
}

curl -v '<IP address or DNS server name>/api/v2/permissions/' --header 'Content-Type: application/json' -H 'Authorization: Bearer <administrator token>'

The example of response:

{
    "results": [
        {
            "id": 2,
            "user": 5,
            "p_code": "ADMINISTRATION",
            "p_types": [
                "R",
                "W"
            ],
            "object_pk": null,
            "human_readable": "Access to the \"Administration\" section"
        },
        {
            "id": 7,
            "user": 5,
            "p_code": "ENVIRONMENTS",
            "p_types": [
                "R",
                "W"
            ],
            "object_pk": null,
            "human_readable": "Access to the \"Environments\" section"
        }
    ]
}

curl -v '<IP address or DNS server name>/api/v2/permissions/<requested access permission identifier>/' --header 'Content-Type: application/json' -H 'Authorization: Bearer <administrator token>'

In the <requested access permissions identifier> substitution use value of the id parameter returned on getting the list of added access permissions.

The example of response:

{
    "id": 6,
    "user": 5,
    "p_code": "PROJECT",
    "p_types": [
        "R",
        "W"
    ],
    "object_pk": 2,
    "human_readable": "Access to the "environment - project" project"
}

curl -X PUT -v '<IP address or DNS server name>/api/v2/permissions/<requested access permission identifier>/' --header 'Content-Type: application/json' -H 'Authorization: Bearer <administrator token>' -d '{
    "user": <administrator identifier>,
    "p_code": "<access permissions code>",
    "p_types": [
        "<access permissions type>"
    ],
    "object_pk": <identifier of access object, specific environment, or project>
}'

In the <requested access permissions identifier> substitution use value of the id parameter returned on getting the list of added access permissions.

The example of response:

{
    "id": 6,
    "user": 4,
    "p_code": "PROJECT",
    "p_types": [
        "R"
    ],
    "object_pk": 2,
    "human_readable": "Access to the "environment - project" project"
}

curl -X DELETE -v '<IP address or DNS server name>/api/v2/permissions/<requested access permission identifier>/' --header 'Content-Type: application/json' -H 'Authorization: Bearer <administrator token>'

In the <requested access permissions identifier> substitution use value of the id parameter returned on getting the list of added access permissions.

The example of response:

204

See also:

Server API