Identity

For the identity collection resource, you can use an object value to return another value for the same object.

Getting an {identityUserId}

IBM Spectrum Protect Plus assigns an ID, {identityUserId}, to each identity.

Method and URI: To convert the value of an object for an identity, use a GET method with a URI:

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

Path: Response body (JSON) > users > name & id

Example: Assume that you added an identity, AD-sarah.wiseman, to IBM Spectrum Protect Plus. A Python snippet that is similar to the following example can be used to return its {identityUserId} value, 2133:

object_name = "AD-sarah.wiseman"

_response = requests.get('https://' + spp_ipv4 + '/api/identity/user',
    headers={...}, verify=...)

_response_json = json.loads(_response.text)    # Convert to JSON

object_json = _response_json['users']

for keys in object_json:
    if keys['name'] == object_name:
        object_id = keys['id']

print(object_id)
2133

Getting an {identityUserHref}

IBM Spectrum Protect Plus assigns a URL, {identityUserId}, to each identity.

Method and URI: To convert the value of an object for an identity, use a GET method with a URI:

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

Path: Response body (JSON) > keys > name & href.

Example: Assume that you added an identity, AD-sarah.wiseman, to IBM Spectrum Protect Plus. A Python snippet that is similar to the following example can be used to return its {identityKeyHref} value, https://10.0.0.100/api/identity/user/2133:

object_name = "AD-sarah.wiseman"

_response = requests.get('https://' + spp_ipv4 + '/api/identity/user',
    headers={...}, verify=...)

_response_json = json.loads(_response.text)    # Convert to JSON

object_json = _response_json['users']

for keys in object_json:
    if keys['name'] == object_name:
        object_href = keys['links']['self']['href']

print(object_href)
https://10.0.0.100/api/identity/user/2133

Getting an {identityKeyId}

IBM Spectrum Protect Plus assigns an ID, {identityKeyId}, to each access key or SSH key.

Method and URI: To convert the value of an object for an access key or SSH key, use a GET method with a URI:

GET     https://{hostname|IP}/api/identity/key

Path: Response body > keys > name & id

Example: Assume that you added an access key, BlueMachines IBM COS Dallas Key, to IBM Spectrum Protect Plus. A Python snippet that is similar to the following example can be used to return its {identityKeyId} value, 1003:

object_name = "BlueMachines IBM COS Dallas Key"

_response = requests.get('https://' + spp_ipv4 + '/api/identity/key',
    headers=..., verify=...)

_response_json = json.loads(_response.text)    # Convert to JSON

object_json = _response_json['keys']

for keys in object_json:
    if keys['name'] == object_name:
        object_id = keys['id']

print(object_id)
1003

You can convert an SSH key name into its ID in a similar way.

Getting an {identityKeyHref}

IBM Spectrum Protect Plus assigns a URL, {identityKeyHref}, to each access key or SSH key.

Method and URI: To convert the value of an object for an access key or SSH key, use a GET method with a URI:

GET     https://{hostname|IP}/api/identity/key

Path: Response body > keys > name & links > self > href.

Example: Assume that you added an access key, BlueMachines IBM COS Dallas Key, to IBM Spectrum Protect Plus. The Python code snippet that is similar to the following example can be used to return its {identityKeyHref} value, https://10.0.0.100/api/identity/key/1003:

object_name = "BlueMachines IBM COS Dallas Key"

_response = requests.get('https://' + spp_ipv4 + '/api/identity/key',
    headers=..., verify=...)

_response_json = json.loads(_response.text)    # Convert to JSON

object_json = _response_json['keys']

for keys in object_json:
    if keys['name'] == object_name:
        object_href = keys['links']['self']['href']

print(object_href)
https://10.0.0.100/api/identity/key/1003

You can convert an SSH key name into its URL in a similar way.