Storage¶
For the storage collection resource, you can use an object value to return another value for the same object.
Getting a {storageId}
¶
IBM Spectrum Protect Plus assigns an ID, {storageId}
, to each storage server.
Method and URI: To convert the value of an object for a storage server, use a GET method with a URI:
GET https://{hostname|IP}/api/storage
Path: Response body (JSON) > storages
> name
& id
.
Example: Assume that you added a vSnap server, 10.0.1.1, to IBM Spectrum Protect Plus. A Python snippet that is similar to the following example can be used to return its {storageId}
value, 2101:
object_name = "10.0.1.1"
_response = requests.get('https://' + spp_ipv4 + '/api/storage',
headers=..., verify=...)
_response_json = json.loads(_response.text) # Convert to JSON
object_json = _response_json['storages']
for keys in object_json:
if keys['name'] == object_name:
object_id = keys['id']
print(object_id)
2101