API ドキュメント

EstaCaido をアプリケーションに統合

はじめに

EstaCaido APIを使うと、モニターの管理、インシデントの表示、アラートの設定などを自分のコードから行えます。すべてのAPIエンドポイントは、リクエストとレスポンスの本文にJSONを使用します。

ベースURL

https://www.estacaido.com/api/v1/

レート制限

各APIトークンは、一分あたり最大 100 件のリクエストを送信できます。上限を超えると 429 Too Many Requests が返されます。

認証

すべてのAPIリクエストにトークン認証を使用します。トークンをAuthorizationヘッダーに含めてください。

認証トークンを取得

POST /api/v1/auth/token/
リクエスト
curl -X POST https://www.estacaido.com/api/v1/auth/token/ \
  -H "Content-Type: application/json" \
  -d '{"username": "your@email.com", "password": "yourpassword"}'
レスポンス
{
  "token": "your-api-token-here"
}

Authorizationヘッダーにトークンを指定します

Authorization: Token your-api-token-here

モニター

ウェブサイトのモニターを管理します。

モニター一覧

GET /api/v1/monitors/
レスポンス
[
  {
    "id": 1,
    "name": "Production API",
    "company": {
      "id": 1,
      "website": "api.example.com"
    },
    "check_type": "http",
    "check_interval": 300,
    "is_active": true,
    "is_paused": false,
    "last_check_at": "2024-01-15T10:30:00Z",
    "created_at": "2024-01-01T00:00:00Z"
  }
]

モニターの作成

POST /api/v1/monitors/
パラメーター
name 必須 モニターの名前
domain 必須 監視するドメイン。例: example.com
check_interval 任意 チェック間隔(秒)。30, 60, 300, 600, 900, 1800, 3600 のいずれか。既定値: 300
check_type 任意 次のいずれかの値: http, https, ping。既定値: https

モニターを取得

GET /api/v1/monitors/{id}/

モニターを更新

PUT /api/v1/monitors/{id}/

モニターを削除

DELETE /api/v1/monitors/{id}/

モニターを一時停止

POST /api/v1/monitors/{id}/pause/

モニターを再開

POST /api/v1/monitors/{id}/resume/

モニター統計を取得

GET /api/v1/monitors/{id}/statistics/
パラメーター
days 任意 対象に含める日数。既定: 30

インシデント

ダウンタイムのインシデントとその履歴を表示します。

インシデント一覧

GET /api/v1/incidents/
パラメーター
status 任意 ステータスで絞り込み: ongoing, resolved
monitor 任意 モニターIDで絞り込み

インシデントを取得

GET /api/v1/incidents/{id}/

アラート

モニターのアラート通知を設定します。

アラート一覧

GET /api/v1/alerts/

アラートを作成

POST /api/v1/alerts/
パラメーター
monitor 必須 モニターID
alert_type 必須 次のいずれかの値: email, sms, slack, discord, webhook, pagerduty, teams
recipients 必須 宛先アドレスまたはWebhook URL
alert_on_down 任意 サイトがダウンしたときに通知 (既定: true)
alert_on_recovery 任意 サイトが復旧したときに通知 (既定: true)

アラートを更新

PUT /api/v1/alerts/{id}/

アラートを削除

DELETE /api/v1/alerts/{id}/

ステータスページ

公開ステータスページを作成・管理します。

ステータスページ一覧

GET /api/v1/status-pages/

ステータスページを作成

POST /api/v1/status-pages/
パラメーター
title 必須 ステータスページのタイトル
slug 必須 URLスラッグ (例: my-status-page)
description 任意 説明文
is_public 任意 公開する (既定: true)

チーム

チームのアクセスと共同作業を管理します。

チーム一覧

GET /api/v1/teams/

チームを作成

POST /api/v1/teams/

チームを取得

GET /api/v1/teams/{id}/

コード例

Python

import requests

API_TOKEN = 'your-api-token'
BASE_URL = 'https://www.estacaido.com/api/v1'

headers = {
    'Authorization': f'Token {API_TOKEN}',
    'Content-Type': 'application/json'
}

# List all monitors
response = requests.get(f'{BASE_URL}/monitors/', headers=headers)
monitors = response.json()
print(monitors)

# Create a new monitor
new_monitor = {
    'name': 'My Website',
    'domain': 'example.com',
    'check_interval': 300
}
response = requests.post(f'{BASE_URL}/monitors/', json=new_monitor, headers=headers)
print(response.json())

JavaScript

const API_TOKEN = 'your-api-token';
const BASE_URL = 'https://www.estacaido.com/api/v1';

const headers = {
    'Authorization': `Token ${API_TOKEN}`,
    'Content-Type': 'application/json'
};

// List all monitors
fetch(`${BASE_URL}/monitors/`, { headers })
    .then(res => res.json())
    .then(monitors => console.log(monitors));

// Create a new monitor
fetch(`${BASE_URL}/monitors/`, {
    method: 'POST',
    headers,
    body: JSON.stringify({
        name: 'My Website',
        domain: 'example.com',
        check_interval: 300
    })
})
.then(res => res.json())
.then(data => console.log(data));

cURL

# List all monitors
curl -X GET https://www.estacaido.com/api/v1/monitors/ \
  -H "Authorization: Token your-api-token"

# Create a new monitor
curl -X POST https://www.estacaido.com/api/v1/monitors/ \
  -H "Authorization: Token your-api-token" \
  -H "Content-Type: application/json" \
  -d '{"name": "My Website", "domain": "example.com", "check_interval": 300}'

始めましょう

無料で登録してAPIトークンを取得し、連携を始めましょう。

無料登録 APIトークンを取得