对于 AI 代理:可在 https://www.mongodb.com/zh-cn/docs/llms.txt 获取文档索引—通过在任何 URL 路径后添加 .md 可获取所有页面的 Markdown 版本。
Docs 菜单

获取所有维护Windows

检索结束日期在未来的所有维护窗口。

您可以使用任何指定角色成功调用该终结点。

基本 URL: https://{OPSMANAGER-HOST}:{PORT}/api/public/v1.0

GET /groups/{PROJECT-ID}/maintenanceWindows/
名称
类型
说明

PROJECT-ID

字符串

项目的唯一标识符。

名称
类型
必要性
说明
默认

pretty

布尔

Optional

指示响应正文是否采用 pretty-print 格式的标志。

false

envelope

布尔

Optional

指示是否将响应包装在信封中的标志。

某些 API 客户端无法访问 HTTP 响应标头或状态代码。要解决这个问题,可在查询中设置 envelope=true。

对于返回一个结果的端点,响应体包括:

  • status: HTTP 响应代码

  • content:预期响应正文

false

此端点不使用 HTTP 请求正文参数。

响应 JSON 文档包括 result 对象数组、link 对象数组和检索到的 result 对象的总数。

名称
类型
说明

results

阵列

数组为results 嵌入式文档 部分中详细介绍的每一项包含一个对象。

links

阵列

数组包含一个或多个指向子资源和/或相关资源的链接。 URL 之间的关系在 Web 链接规范中进行了解释。

totalCount

数字

结果集中项目总数的整数计数。 如果对整个结果集进行分页,则它可能大于results数组中的对象数。

每个结果都是一个维护窗口。

名称
类型
说明

id

字符串

维护窗口的唯一标识符。

groupId

字符串

此维护窗口适用的项目的唯一标识符。

created

字符串

Timestamp in ISO 8601 date and time format in UTC when the maintenance window was created.

updated

字符串

Timestamp in ISO 8601 date and time format in UTC when the maintenance window was last updated.

startDate

字符串

Timestamp in ISO 8601 date and time format in UTC when the maintenance window starts.

endDate

字符串

Timestamp in ISO 8601 date and time format in UTC when the maintenance window ends.

alertTypeNames

字符串数组

在维护窗口期间保持静默的警报类型。 例如: HOST 、 REPLICA_SET 、 CLUSTER 、 AGENT 、 BACKUP

description

字符串

维护窗口的说明。仅当您提供维护窗口的说明时,才会显示此字段。

curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \
--header "Accept: application/json" \
--include \
--request GET "https://<OpsManagerHost>:<Port>/api/public/v1.0/groups/{PROJECT-ID}/maintenanceWindows"
HTTP/1.1 401 Unauthorized
Content-Type: application/json;charset=ISO-8859-1
Date: {dateInUnixFormat}
WWW-Authenticate: Digest realm="MMS Public API", domain="", nonce="{nonce}", algorithm=MD5, op="auth", stale=false
Content-Length: {requestLengthInBytes}
Connection: keep-alive
HTTP/1.1 200 OK
Vary: Accept-Encoding
Content-Type: application/json
Strict-Transport-Security: max-age=300
Date: {dateInUnixFormat}
Connection: keep-alive
Content-Length: {requestLengthInBytes}
X-MongoDB-Service-Version: gitHash={gitHash}; versionString={ApplicationVersion}
1{
2 "results" : [ {
3 "alertTypeNames" : [ "BACKUP" ],
4 "created" : "2015-10-22T15:04:31Z",
5 "description" : "new description",
6 "endDate" : "2015-10-23T23:30:00Z",
7 "groupId" : "{PROJECT-ID}",
8 "id" : "5628faffd4c606594adaa3b2",
9 "startDate" : "2015-10-23T22:00:00Z",
10 "updated" : "2015-10-22T15:04:31Z",
11 "links" : []
12 }, {
13 "alertTypeNames" : [ "AGENT", "BACKUP" ],
14 "created" : "2015-10-22T15:40:09Z",
15 "endDate" : "2015-10-23T23:30:00Z",
16 "groupId" : "{PROJECT-ID}",
17 "id" : "56290359d4c606594adaafe8",
18 "startDate" : "2015-10-23T22:00:00Z",
19 "updated" : "2015-10-22T15:40:09Z",
20 "links" : []
21 } ],
22 "links" : [],
23 "totalCount" : 2
24}