For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/ko/api/latest/feature-flags/add-a-variant-to-a-feature-flag.md. A documentation index is available at /llms.txt.
Language
Datadog site

Feature Flag에 변형 추가

POSThttps://api.datadoghq.com/api/v2/feature-flags/{feature_flag_id}/variantshttps://api.us3.datadoghq.com/api/v2/feature-flags/{feature_flag_id}/variantshttps://api.us5.datadoghq.com/api/v2/feature-flags/{feature_flag_id}/variantshttps://api.datadoghq.eu/api/v2/feature-flags/{feature_flag_id}/variantshttps://api.ap1.datadoghq.com/api/v2/feature-flags/{feature_flag_id}/variantshttps://api.ap2.datadoghq.com/api/v2/feature-flags/{feature_flag_id}/variantshttps://api.uk1.datadoghq.com/api/v2/feature-flags/{feature_flag_id}/variantshttps://api.ddog-gov.com/api/v2/feature-flags/{feature_flag_id}/variantshttps://api.us2.ddog-gov.com/api/v2/feature-flags/{feature_flag_id}/variants

개요

기존 Feature Flag에 새로운 단일 변형을 추가합니다. 이 엔드포인트는 추가 전용이며 기존 변형을 수정하지 않습니다. key가 플래그에 이미 존재하는 요청은 거부되며 409 Conflict가 표시되고, 유형이 플래그의 value_type과 일치하지 않는 value는 거부되며 400이 표시됩니다. 서버가 변형 UUID를 생성하여 응답 본문에 반환합니다. 호출자(예: 플래그 마이그레이션 도구)는 후속 할당 동기화에서 새 변형을 참조하기 위해 이 UUID가 필요합니다.

This endpoint requires the feature_flag_config_write permission.

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

인수

경로 파라미터

이름
유형
설명
feature_flag_id [required]
string

The ID of the feature flag.

요청

Body Data (required)

항목
유형
설명
key [required]
string

변형을 생성하도록 요청합니다.

name [required]
string

The name of the variant.

value [required]
string

The value of the variant as a string.

응답

Created

A variant of a feature flag.

항목
유형
설명
created_at
date-time

The timestamp when the variant was created.

id [required]
uuid

The unique identifier of the variant.

key [required]
string

The unique key of the variant.

name [required]
string

The name of the variant.

updated_at
date-time

The timestamp when the variant was last updated.

value [required]
string

The value of the variant as a string.

코드 예시

Feature Flag에 변형 추가
# Path parameters
export feature_flag_id="550e8400-e29b-41d4-a716-446655440000"

# 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/feature-flags/${feature_flag_id}/variants" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "key": "dark",
      "name": "Dark Theme",
      "value": "dark"
    },
    "type": "variants"
  }
}
EOF
# Path parameters
export feature_flag_id="550e8400-e29b-41d4-a716-446655440000"

# 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/feature-flags/${feature_flag_id}/variants" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "key": "dark",
      "name": "Dark Theme",
      "value": "dark"
    },
    "type": "variants"
  }
}
EOF
# Path parameters
export feature_flag_id="550e8400-e29b-41d4-a716-446655440000"

# 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/feature-flags/${feature_flag_id}/variants" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "key": "dark",
      "name": "Dark Theme",
      "value": "dark"
    },
    "type": "variants"
  }
}
EOF
# Path parameters
export feature_flag_id="550e8400-e29b-41d4-a716-446655440000"

# 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/feature-flags/${feature_flag_id}/variants" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "key": "dark",
      "name": "Dark Theme",
      "value": "dark"
    },
    "type": "variants"
  }
}
EOF
# Path parameters
export feature_flag_id="550e8400-e29b-41d4-a716-446655440000"

# 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/feature-flags/${feature_flag_id}/variants" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "key": "dark",
      "name": "Dark Theme",
      "value": "dark"
    },
    "type": "variants"
  }
}
EOF
# Path parameters
export feature_flag_id="550e8400-e29b-41d4-a716-446655440000"

# 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/feature-flags/${feature_flag_id}/variants" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "key": "dark",
      "name": "Dark Theme",
      "value": "dark"
    },
    "type": "variants"
  }
}
EOF
# Path parameters
export feature_flag_id="550e8400-e29b-41d4-a716-446655440000"

# 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/feature-flags/${feature_flag_id}/variants" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "key": "dark",
      "name": "Dark Theme",
      "value": "dark"
    },
    "type": "variants"
  }
}
EOF
# Path parameters
export feature_flag_id="550e8400-e29b-41d4-a716-446655440000"

# 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/feature-flags/${feature_flag_id}/variants" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "key": "dark",
      "name": "Dark Theme",
      "value": "dark"
    },
    "type": "variants"
  }
}
EOF
# Path parameters
export feature_flag_id="550e8400-e29b-41d4-a716-446655440000"

# 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/feature-flags/${feature_flag_id}/variants" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "key": "dark",
      "name": "Dark Theme",
      "value": "dark"
    },
    "type": "variants"
  }
}
EOF