- API >
- API Resources >
- Teams
Update Team Roles in One Project¶
The Atlas API authenticates using HTTP Digest Authentication. Provide a programmatic API public key and corresponding private key as the username and password when constructing the HTTP request.
To learn how to configure API access for an Atlas project, see Configure Atlas API Access.
https://cloud.mongodb.com/api/atlas/v1.0
Syntax¶
PATCH /groups/{PROJECT-ID}/teams/{TEAM-ID}
Request Path Parameters¶
Path Parameter | Type | Necessity | Description |
---|---|---|---|
PROJECT-ID | string | Required | Unique identifier of the project associated with this team. |
TEAM-ID | string | Required | Unique identifier of the team for which you want to update roles. |
Request Query Parameters¶
Query Parameter | Type | Necessity | Description |
---|---|---|---|
envelope | boolean | Optional | Flag that specifies whether or not to wrap the response in an envelope. Defaults to |
pretty | boolean | Optional | Flag that specifies whether or not to return a "pretty-printed" JSON document. Defaults to |
Request Body Parameters¶
Specify an array of strings, where each string represents one role you want to add to the team. You must specify an array even if you are only associating a single role to the team.
Body Parameter | Type | Necessity | Description |
---|---|---|---|
roleNames | array | Required | Project roles you want to assign the given team. |
Response¶
Response Document¶
The response JSON document includes an array of result objects, an array of link objects, and a count of the total number of result objects retrieved.
Name | Type | Description |
---|---|---|
results | object array | Includes one object for each item detailed in the results array section. |
links | object array | Includes one or more links to sub-resources and/or related resources. The relations between URLs are explained in the Web Linking Specification. |
totalCount | number | Count of the total number of items in the result set. It may be greater than the number of objects in the results array if the entire result set is paginated. |
results
array¶
Each element in the result
array is one set of roles specified for
one team.
Response Parameter | Type | Description |
---|---|---|
roleNames | array | Project roles assigned to
the team for the specified teamsId . |
teamsId | string | Unique identifier of the team assigned the listed roles. |
Example¶
Request¶
curl --user '{PUBLIC-KEY}:{PRIVATE-KEY}' --digest \ --header "Accept: application/json" \ --header "Content-Type: application/json" \ --request PATCH "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}/teams/{TEAM-ID3}?pretty=true" \ --data '{ "roleNames": ["GROUP_OWNER"] }'
Response¶
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}
{ "links": [{ "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}/teams/{TEAM-ID3}?pretty=true&pageNum=1&itemsPerPage=100", "rel": "self" }], "results": [{ "links": [{ "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}/teams/{TEAM-ID1}", "rel": "self" }], "roleNames": ["GROUP_OWNER", "GROUP_DATA_ACCESS_READ_ONLY", "GROUP_DATA_ACCESS_ADMIN", "GROUP_DATA_ACCESS_READ_WRITE", "GROUP_READ_ONLY"], "teamId": "{TEAM-ID1}" }, { "links": [{ "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}/teams/{TEAM-ID2}", "rel": "self" }], "roleNames": ["GROUP_DATA_ACCESS_ADMIN", "GROUP_READ_ONLY"], "teamId": "{TEAM-ID2}" }, { "links": [{ "href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}/teams/{TEAM-ID3}", "rel": "self" }], "roleNames": ["GROUP_OWNER"], "teamId": "{TEAM-ID3}" }], "totalCount": 3 }