Add Teams to a Project
注意
注意:群组和项目是同义词。您的 {PROJECT-ID}
与您的项目 ID 相同。对于现有群组,群组/项目 ID 保持不变。当引用说明时,此页面将使用“群组”这个更为人熟知的术语。端点仍如文档中所述。
注意
此端点与使用LDAP身份验证的项目不兼容。
基本 URL: https://{OPSMANAGER-HOST}:{PORT}/api/public/v1.0
语法
POST /groups/{PROJECT-ID}/teams
请求路径参数
路径元素 | 必需/可选 | 说明 |
---|---|---|
| 必需。 | The unique identifier for the 项目 to which you are adding the team or teams. |
请求查询参数
以下查询参数为可选参数:
请求正文参数
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:
名称 | 类型 | 说明 |
---|---|---|
| 阵列 | Each object in the array represents a project role you want to assign to the team. The valid roles and their associated mappings are:
|
| 字符串 | 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对象总数。
名称 | 类型 | 说明 |
---|---|---|
| 阵列 | 数组为 |
| 阵列 | 数组包含一个或多个指向子资源和/或相关资源的链接。 URL 之间的关系在 Web 链接规范中进行了解释。 |
| 数字 | 结果集中项目总数的整数计数。 如果对整个结果集进行分页,则它可能大于results数组中的对象数。 |
results
嵌入式文档
Each element in the result
array is one team added to the project.
名称 | 类型 | 说明 |
---|---|---|
| 阵列 | 指向子资源和/或相关资源的一个或多个链接。 响应中的所有 |
| 阵列 | 分配给团队的项目角色数组。 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" } ] } ]'
响应示例
响应标头
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}
响应体
{ "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 }