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

ユーザーをチームに追加する

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

概要

ユーザーをチームに追加します。

This endpoint requires the teams_read permission.

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

引数

パスパラメーター

名前
タイプ
説明
team_id [required]
string

None

リクエスト

Body Data (required)

フィールド
タイプ
説明
data [required]
object

チームメンバーシップリクエスト

応答

Represents a user's association to a team

Team membership response

フィールド
タイプ
説明
data
object

A user's relationship with a team

included
[<oneOf>]

Resources related to the team memberships

コード例

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