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