เอกสาร API

เชื่อมโยง EstaCaido กับโปรแกรมของคุณ

เริ่มต้น

API EstaCaido ช่วยให้คุณจัดการการตรวจสอบของคุณ ดูเหตุการณ์ ปรับแต่งการแจ้งเตือน และอื่น ๆ จากโค้ดของคุณเอง จุดจบของ 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: 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 ตัวเลือก ตัวกรองตามสถานะ: กำลังดำเนินการ, แก้ไขแล้ว
monitor ตัวเลือก ตัวกรองโดยใช้หมายเลขจอภาพ

เรียกใช้เหตุการณ์

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

แจ้งเตือน

ปรับแต่งการแจ้งเตือนสำหรับจอภาพของคุณ

รายการการแจ้งเตือน

GET /api/v1/alerts/

สร้างการแจ้งเตือน

POST /api/v1/alerts/
พารามิเตอร์
monitor จำเป็น หมายเลขตัวแสดงผล
alert_type จำเป็น หนึ่งในค่าเหล่านี้: email, sms, slack, discord, webhook, pagerduty, teams
recipients จำเป็น ที่อยู่ผู้รับหรือ URL ของ webhook
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 (เช่น หน้าสถานะของฉัน)
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 Token