Currently, the Add Teams to a Project section of the Atlas API documentation states that the request body should include a roles parameter that is an object array:
... [ { "teamId" : "{TEAM-ID}", "roles" : [ { "roleName" : "GROUP_OWNER" } ] } ] ...
However, if this syntax is used, the following response is received:
{ "detail" : "Invalid attribute roles specified.", "error" : 400, "errorCode" : "INVALID_ATTRIBUTE", "parameters" : [ "roles" ], "reason" : "Bad Request" }
The correct syntax for the request body appears to mirror the response returned via the Get Teams Assigned to a Project API endpoint; a request body parameter, roleNames, which references an array of strings. For example, the following API call succeeds:
curl -u "username:apiKey" --digest \ --header "Accept: application/json" \ --header "Content-Type: application/json" \ --request POST "https://cloud.mongodb.com/api/atlas/v1.0/groups/{GROUP-ID}/teams?pretty=true" --data '[ { "teamId" : "{TEAM-ID}", "roleNames" : [ "GROUP_DATA_ACCESS_READ_ONLY" ] } ]'
The the Add Teams to a Project section of the Atlas API documentation section of the documentation should be updated accordingly.