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