Getting role information

You can get a list of roles and information about each.

Method and URI

To get information about all roles, use a GET method and a URI:

GET     https://{hostname|IP}/api/security/role

To get information about a specific role, use a GET method and a URI:

GET     https://{hostname|IP}/api/security/role/{roleId}

Tip

To get a {roleId} value based on its name, follow the instructions in Getting a {roleId}.

Parameters

None.

Data

None.

Example 1: Get information about all roles

In this example, a Python snippet is used to get information about all roles:

requests.get('https://' + spp_ipv4 + '/api/security/role',
    headers={...}, data="", verify=...)
_images/reference_accounts_role_get01.png

Figure 89 The same action can be taken in the IBM Spectrum Protect Plus web user interface: In the navigation pane, click Accounts > Role. Then, click the refresh icon.

This example shows a list of roles. The HTTP status of the response is 200 (OK).

{
    "links": {...},
    "total": 7,
    "roles": [
        {
            "links": {...},
            "name": "VM Admin",
            "type": "BUILTIN",
            "description": null,
            "displayName": "VM administrator",
            "rbacPath": "role:0/role:997",
            "id": "997",
            "virtualresources": [
                {
                    "links": {...},
                    "name": "Policy",
                    "permissions": [
                        {
                            "name": "policy.create",
                            "virtualResource": "Policy",
                            "displayName": "Create",
                            "id": "policy.create"
                        },
                        {
                            "name": "policy.view",
                            "virtualResource": "Policy",
                            "displayName": "View",
                            "id": "policy.view"
                        },
                        {
                            "name": "policy.edit",
                            "virtualResource": "Policy",
                            "displayName": "Edit",
                            "id": "policy.edit"
                        },
                        {
                            "name": "policy.run",
                            "virtualResource": "Policy",
                            "displayName": "Run",
                            "id": "policy.run"
                        },
                        {
                            "name": "policy.delete",
                            "virtualResource": "Policy",
                            "displayName": "Delete",
                            "id": "policy.delete"
                        }
                    ],
                    "id": "Policy"
                },
                {
                    "links": {...},
                    "name": "Site",
                    "permissions": [
                        {
                            "name": "site.view",
                            "virtualResource": "Site",
                            "displayName": "View",
                            "id": "site.view"
                        }
                    ],
                    "id": "Site"
                },
                {...}, {...}, ..., {...}
            ]
        },
        {...}, {...}, ..., {...}
    ]
}

Example 2: Get information about a specific role

In this example, a Python snippet is used to get information about a specific role: VM Admin ({roleId} 1001).

role_id = "1001"

requests.get('https://' + spp_ipv4 + '/api/security/role/' + role_id,
    headers={...}, data="", verify=...)

The request prompts a response that is structured as shown, with the HTTP status of 200 (OK).

{
    "links": {...},
    "name": "VM Admin",
    "type": "BUILTIN",
    "description": null,
    "displayName": "VM administrator",
    "rbacPath": "role:0/role:997",
    "id": "997",
    "virtualresources": [
        {
            "links": {...},
            "name": "Policy",
            "permissions": [
                {
                    "name": "policy.create",
                    "virtualResource": "Policy",
                    "displayName": "Create",
                    "id": "policy.create"
                },
                {...}, {...}, ..., {...}
            ],
            "id": "Policy"
        },
        {
            "links": {...},
            "name": "Site",
            "permissions": [
                {
                    "name": "site.view",
                    "virtualResource": "Site",
                    "displayName": "View",
                    "id": "site.view"
                }
            ],
            "id": "Site"
        },
        {...}, {...}, ..., {...}
    ]
}