# Status API

## Endpoint

Please note the status APIs use a different subdomain:

terminal

```text
https://meta.ideal-postcodes.co.uk/
```

## Service Status API

request.http

```text
GET /status
```

The status API is a simple way to view our current availability status.

This endpoint aggregates responses from our 3rd party availability monitors and reports a service as down if all probes agree.

This API currently powers the availability table on [status.ideal-postcodes.co.uk](https://status.ideal-postcodes.co.uk).

## Implementation Notes

In terms of implementation, we recommend watching for status numbers of `2` to detect issues on the API (i.e. instead of watching for status numbers which are not `1`).

### Request

request.http

```text
https://meta.ideal-postcodes.co.uk/status
```

### Response

response.jsonjson

```json
{
	"Ideal Postcodes Website": {
		"status": 1,
		"message": "Up"
	},
	"Ideal Postcodes API": {
		"status": 1,
		"message": "Up"
	},
	"Postcodes.io API": {
		"status": 1,
		"message": "Up"
	}
}
```

| Property                    | Description                                                             |
| --------------------------- | ----------------------------------------------------------------------- |
| `"Ideal Postcodes Website"` | Object attribute which denotes a specific service                       |
| `"service.status"`          | `number` Indicates the current state of the service                     |
| `"service.message"`         | `string` Human readable message that corresponds with the status number |

### Status Numbers

| Status | Description                                                                                                                                                                                         |
| ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `0`    | **Uninitialised** - meta.ideal-postcodes.co.uk needs time (a minute or so) to retrieve data from all probes. This status is rare and occurs in the event of a full cache eviction of probe statuses |
| `1`    | **Available** - Service is up                                                                                                                                                                       |
| `2`    | **Down** - Service is down                                                                                                                                                                          |

### Current Tracked Services

| Service                     | Description                                                    |
| --------------------------- | -------------------------------------------------------------- |
| `"Ideal Postcodes Website"` | [ideal-postcodes.co.uk](https://ideal-postcodes.co.uk)         |
| `"Ideal Postcodes API"`     | [api.ideal-postcodes.co.uk](https://api.ideal-postcodes.co.uk) |
| `"Postcodes.io API"`        | [postcodes.io](https://postcodes.io)                           |

## Incidents Feeds

request.http

```text
GET /history.[json|rss|atom]
```

The incidents feed is a pollable endpoint that returns information on historical and ongoing incidents affecting our services.

This API currently powers the incidents table on [status.ideal-postcodes.co.uk](https://status.ideal-postcodes.co.uk).

### JSON Feed: Request

request.http

```text
https://meta.ideal-postcodes.co.uk/history.json
```

### JSON Feed: Response

response.jsonjson

```json
{
  "version":"https://jsonfeed.org/version/1",
  "title":"Ideal Postcodes Status - Incident History",
  "home_page_url":"https://status.ideal-postcodes.co.uk",
  "feed_url":"https://meta.ideal-postcodes.co.uk/history.json",
  "icon":"https://img.ideal-postcodes.co.uk/House%20White%20Gradient%20Icon%403x.png",
  "author":{
    "name":"Ideal Postcodes",
    "url":"https://ideal-postcodes.co.uk"
  },
  "items":[
    {
      "id":"6",
      "content_html":"<p><small>0:00 UTC</small><br/><strong>Identified</strong> - We observed periodic 500 exceptions from our edge webservers as traffic increases this morning. This is due to webserver upgrades and migration to Cloudflare at around 10pm UTC 29/10/2020. We rolled back to our earlier edge webserver infrastructure until the issue can be remedied.</p><p><small>14:32 UTC</small><br/><strong>Resolved</strong> - The source of the issue was remedied. The new edge infrastructure is now receiving all traffic and operating at a 0% exception rate.</p>",
      "url":"https://status.ideal-postcodes.co.uk",
      "title":"Postcodes.io 500 Errors",
      "date_modified":"2020-10-29T00:00:00.000Z",
      "date_published":"2020-10-29T00:00:00.000Z"
    }
  ]
}
```

### Atom Feed: Request

request.http

```text
https://meta.ideal-postcodes.co.uk/history.atom
```

### Atom Feed: Response

response.xmlxml

```xml
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <id>https://status.ideal-postcodes.co.uk</id>
  <title>Ideal Postcodes Status - Incident History</title>
  <updated>2020-10-29T14:32:00.000Z</updated>
  <generator>https://github.com/jpmonette/feed</generator>
  <author>
    <name>Ideal Postcodes</name>
    <email>support@ideal-postcodes.co.uk</email>
    <uri>https://ideal-postcodes.co.uk</uri>
  </author>
  <link rel="alternate" href="https://status.ideal-postcodes.co.uk" />
  <link rel="self" href="https://meta.ideal-postcodes.co.uk/history.atom" />
  <logo>https://img.ideal-postcodes.co.uk/House%20White%20Gradient%20Icon%403x.png</logo>
  <icon>https://img.ideal-postcodes.co.uk/favicon.svg</icon>
  <rights>IDDQD Limited</rights>
  <entry>
    <title type="html"><![CDATA[Postcodes.io 500 Errors]]></title>
    <id>6</id>
    <link href="https://status.ideal-postcodes.co.uk" />
    <updated>2020-10-29T00:00:00.000Z</updated>
    <content type="html"><![CDATA[<p><small>0:00 UTC</small><br/><strong>Identified</strong> - We observed periodic 500 exceptions from our edge webservers as traffic increases this morning. This is due to webserver upgrades and migration to Cloudflare at around 10pm UTC 29/10/2020. We rolled back to our earlier edge webserver infrastructure until the issue can be remedied.</p><p><small>14:32 UTC</small><br/><strong>Resolved</strong> - The source of the issue was remedied. The new edge infrastructure is now receiving all traffic and operating at a 0% exception rate.</p>]]></content>
    <published>2020-10-29T00:00:00.000Z</published>
  </entry>
</feed>
```

### RSS Feed: Request

request.http

```text
https://meta.ideal-postcodes.co.uk/history.rss
```

### RSS Feed: Response

response.xmlxml

```xml
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Ideal Postcodes Status - Incident History</title>
    <link>https://status.ideal-postcodes.co.uk</link>
    <description>undefined</description>
    <lastBuildDate>Thu, 29 Oct 2020 14:32:00 GMT</lastBuildDate>
    <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
    <generator>https://github.com/jpmonette/feed</generator>
    <language>en</language>
    <image>
      <title>Ideal Postcodes Status - Incident History</title>
      <url>https://img.ideal-postcodes.co.uk/House%20White%20Gradient%20Icon%403x.png</url>
      <link>https://status.ideal-postcodes.co.uk</link>
    </image>
    <copyright>IDDQD Limited</copyright>
    <atom:link href="https://meta.ideal-postcodes.co.uk/history.rss" rel="self" type="application/rss+xml" />
    <item>
      <title><![CDATA[Postcodes.io 500 Errors]]></title>
      <link>https://status.ideal-postcodes.co.uk</link>
      <guid>6</guid>
      <pubDate>Thu, 29 Oct 2020 00:00:00 GMT</pubDate>
      <content:encoded><![CDATA[<p><small>0:00 UTC</small><br/><strong>Identified</strong> - We observed periodic 500 exceptions from our edge webservers as traffic increases this morning. This is due to webserver upgrades and migration to Cloudflare at around 10pm UTC 29/10/2020. We rolled back to our earlier edge webserver infrastructure until the issue can be remedied.</p><p><small>14:32 UTC</small><br/><strong>Resolved</strong> - The source of the issue was remedied. The new edge infrastructure is now receiving all traffic and operating at a 0% exception rate.</p>]]></content:encoded>
    </item>
  </channel>
</rss>
```
