Counting protected databases¶
You can count the databases that are protected by IBM Spectrum Protect Plus.
Method and URI¶
To count protected databases that are registered with IBM Spectrum Protect Plus, use a POST method and a URI:
POST https://{hostname|IP}/api/endeavour/catalog/recovery/applicationdatabase
Parameters¶
Parameter 1: action
Invoke aggregate functions. For more information about aggregate functions, follow the instructions in Aggregate functions.
Value:
aggregate
Type: System string. Required. Available in the web user interface.
Data¶
Data 1: op
Use the COUNT()
function for the pk
values. For more information about the COUNT()
function, follow the instructions in COUNT().
Value:
[
{
"operation": "count",
"fieldname": "pk",
"outputname": "count"
}
]
Type: Array. Required. Available in the web user interface.
Example: Count protected databases¶
A Python snippet that is similar to the following example can be used to invoke an aggregate function, COUNT()
, which counts protected databases registered by IBM Spectrum Protect Plus.
_params = {"action": "aggregate"}
_data = f'''{{
"op": [
{{
"operation": "count",
"fieldname": "pk",
"outputname": "count"
}}
]
}}'''
requests.post('https://' + spp_ipv4
+ '/api/endeavour/catalog/recovery/applicationdatabase'
headers={...}, params=_params, data=_data, verify=...)
The request prompts a response that is structured as shown, with the HTTP status of 200 (OK).
{
"links": {...},
"results": [
{
"_id": null,
"count": 100
}
]
}