Post

Atlassian StatusPage Client

Overview

statuspage.io (later acquired by Atlassian and renamed Atlassian Status) is a fairly common service which provides a hosted status page. Part of this service is a publicly-accessible REST API, which enables people and services to get the current status, any current incidents and scheduled maintenance events. While there are a few clients which enable .NET Framework applications to access the private REST API (which enables them to push statuses into statuspage.io), there are very few simple ways to deal with the public REST API. This library meets that need. Its source is also available on GitHub.

Getting Started

The Atlassian Status client is available in the NuGet Gallery. You can install it by running one of the commands below:

Package Manager: Install-Package StatusPageIOClient

.NET CLI: dotnet add package StatusPageIOClient

Then, reference the StatusPageClient class in code as below:

1
2
3
4
5
6
7
var client = new StatusPageClient("[PageId]")
    {
        RetrieveAllMaintenanceEvents = true,
        RetrieveAllIncidents = true
    };

await client.RefreshAsync();

You can now access client.StatusPage to access the results of the API calls.

Use Cases & Caveats

Since Atlassian Status is used so widely, being able to read data from its API allows us to monitor the status of a large number of “infrastructure” services, including GitHub, Cloudflare, SendGrid, Dropbox and Atlassian Status itself. We might just want to record the current status to help build root cause analyses if there’s an outage, or we could do more complex work and queue up background tasks until the service is available, or fail over to a secondary provider. We could also expose this information using ASP.NET’s existing health check infrastructure (at which point a layer seven load balancer might be able to divert users to a static page informing them of the downtime.)

Whatever your use case though, the APIs are rate-limited. Repeated calls to these APIs isn’t advisable. A Windows Service, Azure Function App, Lambda Function or similar background task would be a better fit here, polling the APIs for their current status and writing it into a local data store.

Data Model

There are four key items in the data model: Pages, Components, Incidents, Incident Updates and Scheduled Maintenances.

A Page lies at the root of the Atlassian Status data model. It refers to a single status page, and contains many Components, Incidents and Scheduled Maintenances. You can access this using the StatusPage property, which returns an instance of the StatusPageClient.Models.StatusPage class.

Each Page has a hierarchy of Components. Each item in the hierarchy has a status, name and description. A Component is represented by an instance of the StatusPageClient.Models.Component class.

An Incident is the most complex item in the data model. It has a name (and a direct link to the Atlassian Status web interface), a description of the impact, the start/resolution dates, a list of Incident Updates, the current status and a list of impacted Components. Each Incident is represented by an instance of the StatusPageClient.Models.Incident class.

Incidents also have many Incident Updates. Each of these updates has a piece of text, a status, and an optional link to a Twitter tweet. It is represented by an instance of the StatusPage.Models.IncidentUpdate class.

Finally, a Page also has many Scheduled Maintenances. These are actually variants of Incidents, and have all their fields, plus two additional items which contain the scheduled start/end dates. A Scheduled Maintenance is represented by an instance of the StatusPageClient.Models.ScheduledMaintenance class.

Common Page IDs

Page ID Product
y2j98763l56x Atlassian
208q92hckwws Box
yh6f0r4529hb Cloudflare
1k6wzpspjf99 Datadog
s2k7tnzlhrpw Digital Ocean
srhpyqt94yxb Discord
t34htyd6jblf Dropbox
qrxf5mzbrsxw Duo
kctbh9vrtdwd GitHub
kwzln7bn4hg8 GoToMeeting
1m1j8k4rtldg Intercom
tv3rvsrmny3p InVision
636574ls1dpd Librato
nwg5xmnm9d17 New Relic
t05vdsszxwtq OpsGenie
3tgl2vf85cht SendGrid
202yx2sdrxr3 sendwithus
gpkpyklzq55q Twilio
zjttvm6ql9lp Twitter
750cwd148kqj Wistia
3dqfq14ym6xk xMatters
14qjgk812kgk Zoom

You’ll note that many of these status pages look very similar. In general though, add /api to the end of the URL; alternatively, hit F12 and refresh the page, then look for a web request to status.json. In the response, look at the page property’s id property. This will typically be a twelve-character alphanumeric string.

This post is licensed under CC BY 4.0 by the author.