Tài liệu tham khảo API Thông báo chung

Thông báo chung là các banner cố định hiển thị trên trang trạng thái của bạn (tách biệt với sự cố và bảo trì). Dùng các endpoint này để quản lý chúng bằng chương trình.

Lấy tất cả thông báo chung

Endpoint:

GET /v1/:page_id/generic-notices?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": "cl9mq0ah50646mpvlmbrvf979",
"name": "Scheduled DNS migration",
"message": "We are migrating our DNS provider over the next week.",
"messageHtml": "<p>We are migrating our DNS provider over the next week.</p>",
"notify": false,
"isCollapsed": false,
"createdAt": "2022-10-24T11:53:46.505Z",
"updatedAt": "2022-10-24T11:53:46.505Z",
"siteId": "cl9fzgilx14063qjvl5oqdtxtg",
"importedFrom": null
}
]

Lấy một thông báo chung

Endpoint:

GET /v1/:page_id/generic-notices/:generic_notice_id

Phản hồi ví dụ:

{
"id": "cl9mq0ah50646mpvlmbrvf979",
"name": "Scheduled DNS migration",
"message": "We are migrating our DNS provider over the next week.",
"messageHtml": "<p>We are migrating our DNS provider over the next week.</p>",
"notify": false,
"isCollapsed": false,
"createdAt": "2022-10-24T11:53:46.505Z",
"updatedAt": "2022-10-24T11:53:46.505Z",
"siteId": "cl9fzgilx14063qjvl5oqdtxtg",
"importedFrom": null
}

Thêm một thông báo chung

Endpoint:

POST /v1/:page_id/generic-notices

Tham số body:

  • name (bắt buộc) — tiêu đề của thông báo.
  • message — nội dung của thông báo. Hỗ trợ HTML.
  • notify — có thông báo cho người đăng ký hay không. Mặc định là false.
  • isCollapsed — thông báo có được thu gọn theo mặc định hay không. Mặc định là false.
  • translations — bản dịch tùy chọn cho namemessage, dùng mã ngôn ngữ làm khóa.

Yêu cầu ví dụ:

{
"name": "Scheduled DNS migration",
"message": "We are migrating our DNS provider over the next week.",
"notify": false,
"isCollapsed": false,
"translations": {
"name": {
"fr": "Migration DNS planifiée"
},
"message": {
"fr": "Nous migrons notre fournisseur DNS au cours de la semaine prochaine."
}
}
}

Phản hồi ví dụ:

{
"id": "cl9xobpoe00614tvldhh90t0w",
"name": "Scheduled DNS migration",
"message": "We are migrating our DNS provider over the next week.",
"messageHtml": "<p>We are migrating our DNS provider over the next week.</p>",
"notify": false,
"isCollapsed": false,
"createdAt": "2022-11-01T03:52:08.126Z",
"updatedAt": "2022-11-01T03:52:08.126Z",
"siteId": "cl9fzgilx14063qjvl5oqdtxtg",
"importedFrom": null,
"translations": {
"name": {
"fr": "Migration DNS planifiée"
},
"message": {
"fr": "Nous migrons notre fournisseur DNS au cours de la semaine prochaine."
}
}
}

Cập nhật một thông báo chung

Endpoint:

PUT /v1/:page_id/generic-notices/:generic_notice_id

Chỉ những trường bạn gửi mới được cập nhật.

Yêu cầu ví dụ:

{
"name": "Scheduled DNS migration (rescheduled)",
"message": "The migration has been rescheduled to next month.",
"isCollapsed": true
}

Phản hồi ví dụ:

{
"id": "cl9xobpoe00614tvldhh90t0w",
"name": "Scheduled DNS migration (rescheduled)",
"message": "The migration has been rescheduled to next month.",
"messageHtml": "<p>The migration has been rescheduled to next month.</p>",
"notify": false,
"isCollapsed": true,
"createdAt": "2022-11-01T03:52:08.126Z",
"updatedAt": "2022-11-02T09:14:22.501Z",
"siteId": "cl9fzgilx14063qjvl5oqdtxtg",
"importedFrom": null
}

Xóa một thông báo chung

Endpoint:

DELETE /v1/:page_id/generic-notices/:generic_notice_id

Phản hồi ví dụ:

{
"id": "cl9xobpoe00614tvldhh90t0w",
"name": "Scheduled DNS migration (rescheduled)",
"message": "The migration has been rescheduled to next month.",
"messageHtml": "<p>The migration has been rescheduled to next month.</p>",
"notify": false,
"isCollapsed": true,
"createdAt": "2022-11-01T03:52:08.126Z",
"updatedAt": "2022-11-02T09:14:22.501Z",
"siteId": "cl9fzgilx14063qjvl5oqdtxtg",
"importedFrom": null
}