Go to All Forums

attributes in API monitor group query response?

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!

Like (2) Reply
Replies (4)

current_status api for group should return only one attribute. We acknowledge this as an issue. We will reply here once fixed. Sorry for the trouble. 

Any api change would be backward compatible to avoid breaking existing integrations. If there is any exceptional case of breaking changes, we would notify via forums.

Like (0) Reply

The other attributes are potentially useful information too, and having just "attribute_value" all by itself and the value being a mysterious number is a little weird. So I think the multiple attributes is ok really, but just not what is documented, or what I was previously handling in my script.

Like (0) Reply

You can still use /api/current_status/type/SSL_CERT to get multiple attributes. 

www.site24x7.com/help/api/#current-status-by-monitor-type

"attribute_label", "unit" from the same object needs to be used to know what "attribute_value" holds.

Like (0) Reply

You can still use /api/current_status/type/SSL_CERT to get multiple attributes. 

www.site24x7.com/help/api/#current-status-by-monitor-type

"attribute_label", "unit" from the same object needs to be used to know what "attribute_value" holds.

Like (0) Reply

Was this post helpful?