There doesn't seem to be any way to use REST API calls to produce Availability SLA report similar to the GUI method (containing daily Availability history and business hours). Is there a way to produce and export these reports using automation?
I am using /reports/availability_summary/{monitor_id}?period=7
Additionally, JSON output from that call is flawed - it contains duplicate items ('totaldowntime' and 'TotalDownTime'), which conflict when used with Powershell:
ConvertFrom-Json : Cannot convert the JSON string because a dictionary that was converted from the string contains the duplicated keys 'totaldowntime' and 'TotalDownTime'.
I hope you mean /reports/sla_reports/availability?period={report_period_constants}. We will look into the issue because of case sensitiveness of attribute name. Until then, as a workaround, you can do text replacement for one of those keys in response before using ConvertFrom-Json.
That's what I'm doing for now, thank you.
What about my main question, about using API for producing an overall report like attached report produced using the web interface?
Sorry, there is no JSON based api for that page.
As you have mentioned "reports/availability_summary/{monitor_id}?period=7" api is the closest one available. You can use charts node in the response to get similar data.
For SLA success/failure information you can use "/reports/sla_reports/availability?period={report_period_constants}"