Docs 菜单

Add Teams to a Project

注意

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

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

POST /groups/{PROJECT-ID}/teams
路径元素
必需/可选
说明

PROJECT-ID

必需。

The unique identifier for the 项目 to which you are adding the team or teams.

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

名称
类型
必要性
说明
默认

pageNum

数字

Optional

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

1

itemsPerPage

数字

Optional

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

100

pretty

布尔

Optional

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

false

envelope

布尔

Optional

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

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

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

false

Specify an array of documents, where each document represents one team you want to associate to the project. Each document in the array must contain the following fields:

名称
类型
说明

roleNames

阵列

Each object in the array represents a project role you want to assign to the team.

The valid roles and their associated mappings are:

teamId

字符串

The unique identifier of the team you want to associate with the project. The team and project must share the same parent 组织.

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

名称
类型
说明

results

阵列

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

links

阵列

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

totalCount

数字

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

Each element in the result array is one team added to the project.

名称
类型
说明

links

阵列

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

roleNames

阵列

分配给团队的项目角色数组。

The valid roles and their associated mappings are:

curl -u "username:apiKey" --digest \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--request POST "https://{OPSMANAGER-HOST}:{PORT}/api/public/v1.0/groups/{PROJECT-ID}/teams?pretty=true" \
--data '[ { "teamId" : "{TEAM-ID}", "roles" : [ { "roleName" : "GROUP_OWNER" } ] } ]'
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}
{
"links": [
{
"href": "https://{OPSMANAGER-HOST}:{PORT}/api/public/v1.0/groups/{PROJECT-ID}/teams",
"rel": "self"
}
],
"results": [
{
"links": [
{
"href": "https://cloud.mongodb.com/api/pubic/v1.0/orgs/{ORG-ID}/teams/{TEAM-ID}",
"rel": "self"
}
],
"roleNames": [ "GROUP_OWNER" ],
"teamId": "{TEAM-ID}"
}
],
"totalCount": 1
}