Tài liệu tham khảo API Thành phần

Lấy tất cả thành phần của trang trạng thái

Endpoint:

GET /v2/:page_id/components?page=:page&per_page=:per_page
  • Số trang mặc định là 1.
  • Giá trị per_page mặc định là 50 và tối đa là 100 mục mỗi trang.

Phản hồi ví dụ:

[
{
"id": "ckf01fvnxywz60a35wdbn5gz5",
"name": "App",
"status": "OPERATIONAL",
"uniqueEmail": "nasa-app-1nozrueut@automation.instatus.com",
"description": "",
"showUptime": true,
"order": 0,
"group": null
},
{
"id": "ckf01fvnxywz50a35nh1qzssm",
"name": "Website",
"status": "OPERATIONAL",
"description": "",
"showUptime": true,
"order": 0,
"group": null,
"uniqueEmail": "nasa-website-1nozrueut@automation.instatus.com"
}
]

Lấy một thành phần

Endpoint:

GET /v2/:page_id/components/:component_id

Phản hồi ví dụ

{
"id": "ckf01fvnxywz50a35nh1qzssm",
"name": "Website",
"description": "",
"status": "OPERATIONAL",
"uniqueEmail": "nasa-website-1nozrueut@automation.instatus.com",
"showUptime": true,
"order": 0,
"group": null
}

Lấy thời gian hoạt động của trang trạng thái

Endpoint:

GET /v2/:page_id/uptime?start=:start&end=:end
  • start và end là ngày theo định dạng ISO 8601. Nếu không có, bạn nhận được 30 ngày gần nhất.
  • Khoảng thời gian tối đa là 395 ngày và start phải trước end.

Phản hồi ví dụ:

{
"start": "2026-10-01T00:00:00.000Z",
"end": "2026-10-31T00:00:00.000Z",
"uptime": 99.97,
"components": [
{
"id": "ckf01fvnxywz60a35wdbn5gz5",
"name": "App",
"uptime": 99.95,
"isParent": false,
"children": []
},
{
"id": "ckf01fvnxywz40a35p2c1xk7q",
"name": "API",
"uptime": 99.98,
"isParent": true,
"children": [
{
"id": "ckf01fvnxywz50a35nh1qzssm",
"name": "Auth",
"uptime": 99.96,
"isParent": false,
"children": []
},
{
"id": "ckf01fvnxywz70a35r8m2wq4d",
"name": "Search",
"uptime": 100,
"isParent": false,
"children": []
}
]
}
]
}
  • uptime ở cấp trên cùng áp dụng cho toàn bộ trang: là trung bình của mọi thành phần, được tính giống như thời gian hoạt động của một nhóm.
  • Nhóm có isParent là true và liệt kê các thành phần của nhóm trong children.
  • Chỉ những sự cố gián đoạn đã công bố mới được tính, nên các số liệu khớp với trang trạng thái của bạn.

Tạo một thành phần

Endpoint:

POST /v1/:page_id/components

Yêu cầu ví dụ:

{
"name": "Test component",
"description": "Testing",
"status": "OPERATIONAL",
"order": 6,
"showUptime": true,
"grouped": false,
"archived": false,
"translations": {
"name": {
"fr": "Composant de test"
},
"description": {
"fr": "En test"
}
}
}

Phản hồi ví dụ:

{
"id": "ckf1d4f6a4aaf0a356vqg0rdm",
"name": "Test component",
"description": "Testing",
"uniqueEmail": "nasa-test-component-oomaksikj@automation.instatus.com",
"status": "OPERATIONAL",
"showUptime": true,
"order": 8,
"group": null,
"translations": {
"name": {
"fr": "Composant de test"
},
"description": {
"fr": "En test"
}
}
}

Nếu bạn muốn thêm một thành phần vào trong một nhóm, hãy đặt grouped thành true và group thành ID của nhóm bạn muốn.

Cập nhật một thành phần

Endpoint:

PUT /v2/:page_id/components/:component_id

Yêu cầu ví dụ:

{
"name": "Test component 4",
"description": "Test test test",
"status": "OPERATIONAL",
"order": 6,
"showUptime": true,
"grouped": false,
"archived": true,
"translations": {
"name": {
"fr": "Composant de test 4"
},
"description": {
"fr": "Test test test"
}
}
}

Phản hồi ví dụ:

{
"id": "ckf1d4f6a4aaf0a356vqg0rdm",
"name": "Test component 4",
"uniqueEmail": "nasa-test-component-oomaksikj@automation.instatus.com",
"status": "OPERATIONAL",
"description": "Test test test",
"showUptime": true,
"order": 6,
"group": null,
"translations": {
"name": {
"fr": "Composant de test 4"
},
"description": {
"fr": "Test test test"
}
}
}

Nếu bạn muốn cập nhật nhóm của một thành phần, hãy đặt grouped thành true và groupId thành ID của nhóm bạn muốn.

Xóa một thành phần

Endpoint:

DELETE /v1/:page_id/components/:component_id
{
"id": "ckf1d4f6a4aaf0a356vqg0rdm"
}