Join us at MongoDB.local London on 7 May to unlock new possibilities for your data. Use WEB50 to save 50%.
Register now >
Docs 菜单
Docs 主页
/ /

获取当前用户的所有项目

注意

群组和项目是同义词。您的 {PROJECT-ID} 与您的项目ID相同。对于现有群组,您的群组/项目ID保持不变。本页在引用说明时使用“群组”这个更为人熟知的术语。端点保持文档中所述不变。

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

GET /groups

此端点不使用 HTTP 请求路径参数。

以下查询参数为可选参数:

名称
类型
必要性
说明
默认

pageNum

数字

Optional

从一开始的整数,用于返回结果的一部分。

1

itemsPerPage

数字

Optional

每页要返回的项目数,最多 500 个。

100

pretty

布尔

Optional

指示响应正文是否应采用 美观打印 格式的标志。

false

envelope

布尔

Optional

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

某些 API 客户端无法访问 HTTP 响应标头或状态代码。要修复此问题,在查询中设置 envelope : true

对于返回结果列表的端点, content对象是一个信封。 Ops Manager 将status字段添加到响应正文。

false

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

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

名称
类型
说明

results

阵列

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

links

阵列

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

totalCount

数字

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

每个结果都是一个项目。

名称
类型
说明

ActiveAgentCount

整型

定期向 Ops Manager 发送网络探测(ping)的活动代理数量。

该值大约每24小时刷新并缓存。 如果启动新代理或停止现有代理,则更改最多可能需要30分钟才能显示在activeAgentCount字段中。

hostCounts

对象

按类型划分的主机总数。 嵌入式字段应该是不言自明的。

id

字符串

项目的唯一标识符。

lastActiveAgent

字符串

时间 Ops Manager 上次更新了项目的activeAgentCount总计。 Ops Manager 每 24 小时刷新并缓存该值,以记录活动 MongoDB 代理的数量。

ldapGroupMappings

对象数组

对于支持 LDAP 的 Ops Manager,这是LDAP 群组到 Ops Manager 项目角色的映射。 仅适用于支持 LDAP 的 Ops Manager。

ldapGroupMappings
.roleName

字符串

Ops Manager user role. 项目角色roleName的映射如下:

用户角色
roleName

Project Owner (必需)

GROUP_OWNER

GROUP_AUTOMATION_ADMIN

GROUP_BACKUP_ADMIN

GROUP_MONITORING_ADMIN

GROUP_DATA_ACCESS_ADMIN

GROUP_DATA_ACCESS_READ_WRITE

GROUP_DATA_ACCESS_READ_ONLY

GROUP_READ_ONLY

ldapGroupMappings
.ldapGroups

字符串数组

映射到 Ops Manager 角色的 LDAP 项目。

链接

对象数组

指向子资源或相关资源的一个或多个链接。响应中的所有links 数组至少包含一个名为self 的链接。 URL之间的关系在 Web 链接规范中进行了解释。

名称

字符串

项目的显示名称。

orgId

字符串

项目所属组织的唯一标识符。

publicApiEnabled

布尔

指示为此项目启用API的标志。 这是一个始终为true的只读字段。

replicaSetCount

整型

此项目的副本集总数。

shardCount

整型

此项目的分片总数。

标记

字符串数组

分配给项目的标签,用于以编程方式标识项目。

一个项目最多可以有 10 个标签。 标签遵循以下规则:

  • 区分大小写

  • 可以包含以下字符:

    • A 通过 Z

    • 0 通过 9

    • . (句点)

    • _ (下划线)

    • - (破折号)

  • 限制为 32 个字符

1curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \
2 --header "Accept: application/json" \
3 --include \
4 --request GET "https://{opsManagerHost}:{port}/api/public/v1.0/groups?pretty=true"
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 "links": [{
3 "href": "https://<OpsManagerHost>:<Port>/api/public/v1.0/groups?pretty=true&pageNum=1&itemsPerPage=100",
4 "rel": "self"
5 }, {
6 "href": "https://<OpsManagerHost>:<Port>/api/public/v1.0/groups?pretty=true&itemsPerPage=100&pageNum=2",
7 "rel": "next"
8 }],
9 "results": [{
10 "activeAgentCount": 0,
11 "hostCounts": {
12 "arbiter": 0,
13 "config": 0,
14 "mongos": 0,
15 "primary": 0,
16 "secondary": 0
17 },
18 "id": "56a10a80e4b0fd3b9a9bb0c2",
19 "lastActiveAgent": "2016-03-09T18:19:37Z",
20 "links": [{
21 "href": "https://<OpsManagerHost>:<Port>/api/public/v1.0/groups/{PROJECT-ID}",
22 "rel": "self"
23 }],
24 "name": "012i3091203jioawjioej",
25 "orgId": "5980cfdf0b6d97029d82f86e",
26 "publicApiEnabled": true,
27 "replicaSetCount": 0,
28 "shardCount": 0,
29 "tags": []
30 }, {
31 "activeAgentCount": 0,
32 "hostCounts": {
33 "arbiter": 0,
34 "config": 0,
35 "mongos": 0,
36 "primary": 0,
37 "secondary": 0
38 },
39 "id": "56aa691ce4b0a0e8c4be51f7",
40 "lastActiveAgent": "2016-01-29T19:02:56Z",
41 "links": [{
42 "href": "https://<OpsManagerHost>:<Port>/api/public/v1.0/groups/{PROJECT-ID}",
43 "rel": "self"
44 }],
45 "name": "1454008603036",
46 "orgId": "5980d0040b6d97029d831798",
47 "publicApiEnabled": true,
48 "replicaSetCount": 0,
49 "shardCount": 0,
50 "tags": []
51 }, {
52 "activeAgentCount": 0,
53 "hostCounts": {
54 "arbiter": 0,
55 "config": 0,
56 "mongos": 0,
57 "primary": 0,
58 "secondary": 0
59 },
60 "id": "56aa6dfde4b0fe328eee82ad",
61 "lastActiveAgent": "2016-01-29T20:34:28Z",
62 "links": [{
63 "href": "https://<OpsManagerHost>:<Port>/api/public/v1.0/groups/{PROJECT-ID}",
64 "rel": "self"
65 }],
66 "name": "1454009852809",
67 "orgId": "5980d0040b6d97029d831799",
68 "publicApiEnabled": true,
69 "replicaSetCount": 0,
70 "shardCount": 0,
71 "tags": []
72 }, {
73 "activeAgentCount": 0,
74 "hostCounts": {
75 "arbiter": 0,
76 "config": 0,
77 "mongos": 0,
78 "primary": 0,
79 "secondary": 0
80 },
81 "id": "56aa8421e4b0d04c1c54df99",
82 "lastActiveAgent": "2016-01-29T21:36:10Z",
83 "links": [{
84 "href": "https://<OpsManagerHost>:<Port>/api/public/v1.0/groups/{PROJECT-ID}",
85 "rel": "self"
86 }],
87 "name": "1454015520776",
88 "orgId": "5980d0040b6d97029d83179a",
89 "publicApiEnabled": true,
90 "replicaSetCount": 0,
91 "shardCount": 0,
92 "tags": []
93 }, {
94 "activeAgentCount": 0,
95 "hostCounts": {
96 "arbiter": 0,
97 "config": 0,
98 "mongos": 0,
99 "primary": 0,
100 "secondary": 0
101 },
102 "id": "56aa85f9e4b0d04c1c54e347",
103 "lastActiveAgent": "2016-01-29T21:36:10Z",
104 "links": [{
105 "href": "https://<OpsManagerHost>:<Port>/api/public/v1.0/groups/{PROJECT-ID}",
106 "rel": "self"
107 }],
108 "name": "1454015992252",
109 "orgId": "5980d0040b6d97029d83179b",
110 "publicApiEnabled": true,
111 "replicaSetCount": 0,
112 "shardCount": 0,
113 "tags": []
114 }],
115 "totalCount": 5
116}

后退

项目

在此页面上