Getting user information

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

Method and URI

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

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

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

GET     https://{hostname|IP}/api/security/user/{userId}

Tip

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

Parameters

None.

Data

None.

Example 1: Get information about all users

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

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

Figure 76 The same action can be taken in the IBM Spectrum Protect Plus web user interface: In the navigation pane, click Accounts > User. In the list, click a user to view details.

This example shows a list of all users. The HTTP status of the response is 200 (OK). The response body below suggests that there are three users: Sarah (userId: 1005), sppadmin (userId: 1000) and Sales_Americas (userId: 1006), which is an LDAP group.

{
    "links": {...},
    "total": 3,
    "users": [
        {
            "links": {...},
            "name": "Sarah",
            "type": "NATIVE_USER",
            "typeDisplayName": "Native User",
            "tenantId": 1000,
            "loginCount": 0,
            "lastLogin": null,
            "failedLogin": 0,
            "lastFailedLogin": null,
            "lastPasswordUpdate": 1585007826754,
            "passwordAge": 0,
            "passwordExpiresAt": 0,
            "passwordExpired": false,
            "accountDisabled": false,
            "accountLocked": false,
            "rbacPath": "user:0/user:1005",
            "permissions": [
                {
                    "resourcePool": {
                        "links": {...},
                        "name": "BlueMachines - Dallas",
                        "description": "",
                        "total": 0,
                        "resources": [
                            {
                                "metadata": {
                                    "href_host": "",
                                    "href_path": "",
                                    "id": "1001",
                                    "name": "10.0.0.10",
                                    "typeTitle": "Hypervisor",
                                    "path": "Hypervisor:hypervisor/VMware:vmware
↪/vCenters:vcenters/10.0.0.10:1001"
                                },
                                "include": true,
                                "path": "root:0/hypervisor.all:0/hypervisor.type
↪:vmware/hypervisor:1001",
                                "displayName": "10.0.0.10"
                            },
                            {
                                "metadata": {
                                    "href_host": "",
                                    "href_path": "",
                                    "id": "all",
                                    "name": "All",
                                    "typeTitle": "All",
                                    "path": "Screen:screen/All:all"
                                },
                                "include": true,
                                "path": "root:0/screen:0",
                                "displayName": "All"
                            }
                        ],
                        "rbacPath": "resourcepool:0/resourcepool:1002",
                        "id": "1002"
                    },
                    "roles": [
                        {
                            "links": {...},
                            "name": "Self Service",
                            "type": "BUILTIN",
                            "description": null,
                            "displayName": "Self service",
                            "rbacPath": "role:0/role:992",
                            "id" "992",
                            "virtualresources": [
                                {
                                    "links": {...},
                                    "name": "Policy",
                                    "permissions": [
                                        {
                                            "name": "policy.view",
                                            "virtualResource": "Policy",
                                            "displayName": "View",
                                            "id": "policy.view"
                                        }
                                    ],
                                    "id": "Policy"
                                },
                                {
                                    "links": {...},
                                    "name": "Site",
                                    "permissions": [...],
                                    "id": "Site"
                                },
                                {...}, ..., {...}
                            ]
                        },
                        {
                            "links": {...},
                            "name": "Backup Only",
                            "type": "BUILTIN",
                            "description": null,
                            "displayName": "Backup only",
                            "rbacPath": "role:0/role:994",
                            "id": "994",
                            "virtualresources": [...]
                        }
                    ],
                    "permissionIds": [],
                    "roleIds": []
                }
            ],
            "id": "1005"
        },
        {
            "links": {...},
            "name": "sppadmin",
            "type": "NATIVE_USER",
            "typeDisplayName": "Native User",
            "tenantId": 1000,
            "loginCount": 1,
            "lastLogin": 1584468081598,
            "failedLogin": 0,
            "lastFailedLogin": 1584468072009,
            "lastPasswordUpdate": 1574191518133,
            "passwordAge": 0,
            "passwordExpiresAt": 0,
            "passwordExpired": false,
            "accountDisabled": false,
            "accountLocked": false,
            "rbacPath": "user:0/user:1000",
            "permissions": [
                {
                    "resourcePool": {
                        "links": {...},
                        "name": "All Resources",
                        "description": "Includes every resource in the system. ",
                        "total": 0,
                        "resources": [
                            {
                                "metadata": {},
                                "include": true,
                                "path": "root:0",
                                "displayName": "Unknown"
                            }
                        ],
                        "rbacPath": "resourcepool:0/resourcepool:1001",
                        "id": "1001"
                    },
                    "roles": [
                        {
                            "links": {...},
                            "name": "SUPERUSER",
                            "type": "BUILTIN",
                            "description": null,
                            "displayName": "SUPERUSER",
                            "rbacPath": "role:0/role:1000",
                            "id": "1000",
                            "virtualresources": []
                        }
                    ],
                    "permissionIds": [],
                    "roleIds": []
                }
            ],
            "id": "1000"
        },
        {
            "links": {...},
            "name": "Sales_Americas",
            "type": "LDAP_GROUP",
            "typeDisplayName": "LDAP Group",
            "tenantId": 1000,
            "loginCount": 0,
            "lastLogin": null,
            "failedLogin": 0,
            "lastFailedLogin": null,
            "lastPasswordUpdate": 1585045976570,
            "passwordAge": 0,
            "passwordExpiresAt": 0,
            "passwordExpired": false,
            "accountDisabled": false,
            "accountLocked": false,
            "rbacPath": "user:0/user:1006",
            "permissions": [...],
            "id": "1006"
        },
        {...}
    ]
}

Example 2: Get information about a specific user

The following Python snippet can be used to get information about a specific user: Sarah ({userId}: 1005).

user_id = "1005"

requests.get('https://' + spp_ipv4 + '/api/security/user/' + user_id,
     headers={...}, data="", verify=...)
{
    links": {...},
    "name": "Sarah",
    "type": "NATIVE_USER",
    "typeDisplayName": "Native User",
    "tenantId": 1000,
    "loginCount": 0,
    "lastLogin": null,
    "failedLogin": 0,
    "lastFailedLogin": null,
    "lastPasswordUpdate": 1585007826754,
    "passwordAge": 0,
    "passwordExpiresAt": 0,
    "passwordExpired": false,
    "accountDisabled": false,
    "accountLocked": false,
    "rbacPath": "user:0/user:1005",
    "permissions": [...],
    "personas": [],
    "id": "1007"
}

You can get a similar record if you use a {userId} for an LDAP group.