Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-11720

Atlas "Add Teams to Project" API Endpoint Correction

    • Type: Icon: Task Task
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: API, Atlas
    • Labels:
      None

      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.

            Assignee:
            rob.justice@mongodb.com Robert Justice (Inactive)
            Reporter:
            luke.phillippi@mongodb.com Luke Phillippi
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              5 years, 49 weeks, 5 days ago