注意
注意:群组和项目是同义词。您的 {PROJECT-ID} 与您的项目 ID 相同。对于现有群组,群组/项目 ID 保持不变。当引用说明时,此页面将使用“群组”这个更为人熟知的术语。端点仍如文档中所述。
基本 URL: https://cloud.mongodb.com/api/public/v1.0
Resource
GET /groups 
请求参数
请求路径参数
此端点不使用 HTTP 请求路径参数。
请求查询参数
以下查询参数为可选参数:
| 名称 | 类型 | 必要性 | 说明 | 默认 | 
|---|---|---|---|---|
| pageNum | 数字 | Optional | 从一开始的整数,用于返回结果的一部分。 | 
 | 
| itemsPerPage | 数字 | Optional | 每页要返回的项目数,最多 500 个。 | 
 | 
| pretty | 布尔 | Optional | 指示响应正文是否应采用美观打印格式的标志。 | 
 | 
| envelope | 布尔 | Optional | 指示是否将响应包装在信封中的标志。 某些 API 客户端无法访问 HTTP 响应标头或状态代码。要修复此问题,在查询中设置  对于返回结果列表的端点, | 
 | 
| backupJobsEnabledOnly | 布尔 | Optional | 指示是否从响应中排除未启用备份数据库的守护进程的标志。 将其设置为 | 
 | 
请求正文参数
此端点不使用 HTTP 请求正文参数。
响应
响应文档
响应JSON文档包括一个 result对象数组、一个link对象数组以及检索到的result对象总数。
| 名称 | 类型 | 说明 | 
|---|---|---|
| 
 | 阵列 | 数组为 | 
| 
 | 阵列 | 数组包含一个或多个指向子资源和/或相关资源的链接。URL之间的关系在Web 链接规范中进行了解释。 | 
| 
 | 数字 | 结果集中项目总数的整数计数。 如果对整个结果集进行分页,则它可能大于results数组中的对象数。 | 
results 嵌入式文档
每个结果都是一个项目。
| 名称 | 类型 | 说明 | 
|---|---|---|
| ActiveAgentCount | 整型 | 定期向Cloud Manager发送 ping 的活动代理数量。 该值大约每24小时刷新并缓存。 如果启动新代理或停止现有代理,则更改最多可能需要30分钟才能显示在 | 
| hostCounts | 对象 | 按类型划分的主机总数。 嵌入式字段应该是不言自明的。 | 
| id | 字符串 | 群组的唯一标识符。 | 
| lastActiveAgent | 字符串 | Time Cloud Manager 上次更新项目的 | 
| 链接 | 对象数组 | 指向子资源和/或相关资源的一个或多个链接。响应中的所有  | 
| 名称 | 字符串 | 项目的显示名称。 | 
| orgId | 字符串 | 项目所属组织的唯一标识符。 | 
| publicApiEnabled | 布尔 | 指示为此项目启用API的标志。 这是一个始终为 | 
| replicaSetCount | 整型 | 此项目的副本集总数。 | 
| shardCount | 整型 | 此项目的分片总数。 | 
请求示例
1 curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \ 2      --header "Accept: application/json" \ 3      --include \ 4      --request GET "https://cloud.mongodb.com/api/public/v1.0/groups?pretty=true" 
响应示例
响应标头
 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 
 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://cloud.mongodb.com/api/public/v1.0/groups?pretty=true&pageNum=1&itemsPerPage=100", 4     "rel": "self" 5   }, { 6     "href": "https://cloud.mongodb.com/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://cloud.mongodb.com/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://cloud.mongodb.com/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://cloud.mongodb.com/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://cloud.mongodb.com/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://cloud.mongodb.com/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 }