Security¶
For the security collection resource, you can use an object value to return another value for the same object.
Getting a {userId}
¶
IBM Spectrum Protect Plus assigns an ID {userId}
to each user.
Method and URI: To convert the value of an object for a user, use a GET method with a URI:
GET https://{hostname|IP}/api/security/user
Path: Response body (JSON) > users
> name
& id
.
Example: Assume that you added a user, Sarah, to IBM Spectrum Protect Plus. A Python snippet that is similar to the following example can be used to return the {userId}
value, 1001:
object_name = "Sarah"
_response = requests.get('https://' + spp_ipv4 + '/api/security/user',
headers={...}, verify=...)
_response_json = json.loads(_response.text) # Convert to JSON
object_json = _response_json['users'] # Get the specific object
for keys in object_json:
if keys['name'] == object_name:
object_id = keys['id']
print(object_id)
1001
Getting a {roleId}
¶
IBM Spectrum Protect Plus assigns an ID {roleId}
to each role.
Method and URI: To convert the value of an object for role, use a GET method with a URI:
GET https://{hostname|IP}/api/security/role
Path: Response body (JSON) > roles
> name
& id
.
Example: Assume that you added a role, Visitor, to IBM Spectrum Protect Plus. A Python snippet that is similar to the following example can be used to return its {roleId}
value, 1002:
object_name = "Visitor"
_response = requests.get('https://' + spp_ipv4 + '/api/security/role',
headers={...}, verify=...)
_response_json = json.loads(_response.text) # Convert to JSON
_response_json_object = _response_json['roles'] # Get the specific object
for keys in _response_json_object:
if keys['name'] == object_name:
object_id = keys['id']
print(object_id)
1002
Getting a {resourcepoolId}
¶
IBM Spectrum Protect Plus assigns an ID {resourcepoolId}
to each resource group.
Method and URI: To convert the value of an object for a resource group, use a GET method with a URI:
GET https://{hostname|IP}/api/security/resourcepool
Path: Response body (JSON) > resourcepools
> name
& id
.
Example: Assume that you added a resource group, BlueMachines - Dallas, to IBM Spectrum Protect Plus. A Python snippet that is similar to the following example can be used to return its {resourcepoolId}
value, 1002:
object_name = "BlueMachines - Dallas"
_response = requests.get('https://' + spp_ipv4 + '/api/security/resourcepool',
headers={...}, verify=...)
_response_json = json.loads(_response.text) # Convert to JSON
object_json = _response_json['resourcepools']
for keys in object_json:
if keys['name'] == object_name:
object_id = keys['id']
print(object_id)
1002
Getting a {certificateId}
¶
IBM Spectrum Protect Plus assigns an ID {certificateId}
to each certificate.
Method and URI: To convert the value of an object for a certificate, use a GET method with a URI:
GET https://{hostname|IP}/api/security/certificate
Path: Response body (JSON) > certificates
> name
& id
.
Example: Assume that you added a certificate, “BlueMachines - Cert IBM Spectrum Protect”, to IBM Spectrum Protect Plus. A Python snippet that is similar to the following example can be used to return its {certificateId}
value, 1286:
object_name = "BlueMachines - Cert IBM Spectrum Protect"
_response = requests.get('https://' + spp_ipv4 + '/api/security/certificate',
headers={...}, verify=...)
_response_json = json.loads(_response.text) # Convert to JSON
object_json = _response_json['certificates']
for keys in object_json:
if keys['name'] == object_name:
object_id = keys['id']
print(object_id)
1286
Getting a {certificateHref}
¶
IBM Spectrum Protect Plus assigns a URL {certificateHref}
to each certificate.
Method and URI: To convert the value of an object for a certificate, use a GET method with a URI:
GET https://{hostname|IP}/api/security/certificate
Path: Response body (JSON) > certificates
> name
& links
> self
> href
.
Example: Assume that you added a certificate, “BlueMachines - Cert IBM Spectrum Protect”, to IBM Spectrum Protect Plus. A Python snippet that is similar to the following example can be used to return its {certificateHref}
value:
object_name = "BlueMachines - Cert IBM Spectrum Protect"
_response = requests.get('https://' + spp_ipv4 + '/api/security/certificate',
headers={...}, verify=...)
_response_json = json.loads(_response.text) # Convert to JSON
object_json = _response_json['certificates']
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/security/certificate/1286