For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/stefon.simmons/docs-astro-web-10435/fr/api/latest/teams/add-a-user-to-a-team.md. A documentation index is available at /llms.txt.
Language
Datadog site

Ajouter un utilisateur à une équipe

POSThttps://api.datadoghq.com/api/v2/team/{team_id}/membershipshttps://api.us3.datadoghq.com/api/v2/team/{team_id}/membershipshttps://api.us5.datadoghq.com/api/v2/team/{team_id}/membershipshttps://api.datadoghq.eu/api/v2/team/{team_id}/membershipshttps://api.ap1.datadoghq.com/api/v2/team/{team_id}/membershipshttps://api.ap2.datadoghq.com/api/v2/team/{team_id}/membershipshttps://api.uk1.datadoghq.com/api/v2/team/{team_id}/membershipshttps://api.ddog-gov.com/api/v2/team/{team_id}/membershipshttps://api.us2.ddog-gov.com/api/v2/team/{team_id}/memberships

Présentation

Ajouter un utilisateur à une équipe.

Remarque : chaque équipe dispose d'un paramètre déterminant qui est autorisé à modifier l'appartenance à l'équipe. L'autorisation user_access_manage accorde généralement l'accès pour modifier l'appartenance à n'importe quelle équipe. Pour obtenir une vue d'ensemble complète, consultez la documentation sur l'appartenance aux équipes.

This endpoint requires the teams_read permission.

OAuth apps require the teams_read authorization scope to access this endpoint.

Arguments

Paramètres du chemin

Name
Type
Description
team_id [required]
string

None

Requête

Body Data (required)

Champ
Type
Description
data [required]
object

Requête de composition dʼéquipe

Réponse

Represents a user's association to a team

Team membership response

Champ
Type
Description
data
object

A user's relationship with a team

included
[<oneOf>]

Resources related to the team memberships

Exemple de code

Add a user to a team returns "Represents a user's association to a team" response
# Path parameters
export team_id="CHANGE_ME"

# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/team/${team_id}/memberships" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "role": "admin"
    },
    "relationships": {
      "user": {
        "data": {
          "id": "string",
          "type": "users"
        }
      }
    },
    "type": "team_memberships"
  }
}
EOF
# Path parameters
export team_id="CHANGE_ME"

# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/team/${team_id}/memberships" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "role": "admin"
    },
    "relationships": {
      "user": {
        "data": {
          "id": "string",
          "type": "users"
        }
      }
    },
    "type": "team_memberships"
  }
}
EOF
# Path parameters
export team_id="CHANGE_ME"

# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/team/${team_id}/memberships" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "role": "admin"
    },
    "relationships": {
      "user": {
        "data": {
          "id": "string",
          "type": "users"
        }
      }
    },
    "type": "team_memberships"
  }
}
EOF
# Path parameters
export team_id="CHANGE_ME"

# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/team/${team_id}/memberships" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "role": "admin"
    },
    "relationships": {
      "user": {
        "data": {
          "id": "string",
          "type": "users"
        }
      }
    },
    "type": "team_memberships"
  }
}
EOF
# Path parameters
export team_id="CHANGE_ME"

# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/team/${team_id}/memberships" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "role": "admin"
    },
    "relationships": {
      "user": {
        "data": {
          "id": "string",
          "type": "users"
        }
      }
    },
    "type": "team_memberships"
  }
}
EOF
# Path parameters
export team_id="CHANGE_ME"

# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/team/${team_id}/memberships" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "role": "admin"
    },
    "relationships": {
      "user": {
        "data": {
          "id": "string",
          "type": "users"
        }
      }
    },
    "type": "team_memberships"
  }
}
EOF
# Path parameters
export team_id="CHANGE_ME"

# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/team/${team_id}/memberships" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "role": "admin"
    },
    "relationships": {
      "user": {
        "data": {
          "id": "string",
          "type": "users"
        }
      }
    },
    "type": "team_memberships"
  }
}
EOF
# Path parameters
export team_id="CHANGE_ME"

# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/team/${team_id}/memberships" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "role": "admin"
    },
    "relationships": {
      "user": {
        "data": {
          "id": "string",
          "type": "users"
        }
      }
    },
    "type": "team_memberships"
  }
}
EOF
# Path parameters
export team_id="CHANGE_ME"

# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/team/${team_id}/memberships" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "role": "admin"
    },
    "relationships": {
      "user": {
        "data": {
          "id": "string",
          "type": "users"
        }
      }
    },
    "type": "team_memberships"
  }
}
EOF