I'm querying the API like www.site24x7.com/api/current_status/group/81729000004863001?suspended_required=true
and I wrote a script assuming there would be one "attribute_value" for each monitor in the response, according to the document at www.site24x7.com/help/api/#current-status-of-monitor-group
My report runs once a month (checking SSL cert expirations), and it worked fine until February when I started seeing a list of "attributes" per monitor, each with an "attribute_value" instead of the single "attribute_value".
"attributes": [
{
"attribute_key": "number_of_days_to_expire",
"attribute_label": "Days to Expire ",
"attribute_value": 914,
"unit": "day(s)"
},
{
"attribute_key": "issued_date",
"attribute_label": "Issued Date",
"attribute_value": "2017-09-12T14:25:03-0700"
},
{
"attribute_key": "expiry_date",
"attribute_label": "Expiry Date",
"attribute_value": "2020-10-17T16:29:36-0700"
}
],
So I made this change in my python script which solves the problem:
127c128,130
< this_monitor_days_to_expire = int(this_monitor['attribute_value'])
---
> for attribute in this_monitor['attributes']:
> if attribute['attribute_key'] == 'number_of_days_to_expire':
> this_monitor_days_to_expire = int(attribute['attribute_value'])
What is the right way to do it though? Is the document wrong? Did the API change? How should I learn about API changes in the future?
Thanks!