InfoGrab Docs

피처 플래그 API

요약

이 API를 사용하여 GitLab 피처 플래그와 상호 작용합니다. 요청한 프로젝트의 모든 피처 플래그를 가져옵니다. page 및 per_page 페이지네이션 파라미터를 사용하여 결과의 페이지네이션을 제어합니다. 지정된 프로젝트에 대한 피처 플래그를 생성합니다.

히스토리
  • GitLab Premium 12.5에서 도입.
  • GitLab Free 13.5로 이동.

이 API를 사용하여 GitLab 피처 플래그와 상호 작용합니다.

사전 요구사항:

  • Developer, Maintainer 또는 Owner 권한이 있어야 합니다.

프로젝트의 피처 플래그 목록 조회#

요청한 프로젝트의 모든 피처 플래그를 가져옵니다.

GET /projects/:id/feature_flags

pageper_page 페이지네이션 파라미터를 사용하여 결과의 페이지네이션을 제어합니다.

속성 유형 필수 설명
id 정수 또는 문자열 프로젝트의 ID 또는 URL 인코딩된 경로.
scope 문자열 아니오 피처 플래그의 조건, enabled, disabled 중 하나.
curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/1/feature_flags"

응답 예시:

[
   {
      "name":"merge_train",
      "description":"This feature is about merge train",
      "active": true,
      "version": "new_version_flag",
      "created_at":"2019-11-04T08:13:51.423Z",
      "updated_at":"2019-11-04T08:13:51.423Z",
      "scopes":[],
      "strategies": [
        {
          "id": 1,
          "name": "userWithId",
          "parameters": {
            "userIds": "user1"
          },
          "scopes": [
            {
              "id": 1,
              "environment_scope": "production"
            }
          ],
          "user_list": null
        }
      ]
   },
   {
      "name":"new_live_trace",
      "description":"This is a new live trace feature",
      "active": true,
      "version": "new_version_flag",
      "created_at":"2019-11-04T08:13:10.507Z",
      "updated_at":"2019-11-04T08:13:10.507Z",
      "scopes":[],
      "strategies": [
        {
          "id": 2,
          "name": "default",
          "parameters": {},
          "scopes": [
            {
              "id": 2,
              "environment_scope": "staging"
            }
          ],
          "user_list": null
        }
      ]
   },
   {
      "name":"user_list",
      "description":"This feature is about user list",
      "active": true,
      "version": "new_version_flag",
      "created_at":"2019-11-04T08:13:10.507Z",
      "updated_at":"2019-11-04T08:13:10.507Z",
      "scopes":[],
      "strategies": [
        {
          "id": 2,
          "name": "gitlabUserList",
          "parameters": {},
          "scopes": [
            {
              "id": 2,
              "environment_scope": "staging"
            }
          ],
          "user_list": {
            "id": 1,
            "iid": 1,
            "name": "My user list",
            "user_xids": "user1,user2,user3"
          }
        }
      ]
   }
]

피처 플래그 조회#

지정된 피처 플래그를 조회합니다.

GET /projects/:id/feature_flags/:feature_flag_name

pageper_page 페이지네이션 파라미터를 사용하여 결과의 페이지네이션을 제어합니다.

속성 유형 필수 설명
id 정수 또는 문자열 프로젝트의 ID 또는 URL 인코딩된 경로.
feature_flag_name 문자열 피처 플래그의 이름.
curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/1/feature_flags/awesome_feature"

응답 예시:

{
  "name": "awesome_feature",
  "description": null,
  "active": true,
  "version": "new_version_flag",
  "created_at": "2020-05-13T19:56:33.119Z",
  "updated_at": "2020-05-13T19:56:33.119Z",
  "scopes": [],
  "strategies": [
    {
      "id": 36,
      "name": "default",
      "parameters": {},
      "scopes": [
        {
          "id": 37,
          "environment_scope": "production"
        }
      ],
      "user_list": null
    }
  ]
}

피처 플래그 생성#

지정된 프로젝트에 대한 피처 플래그를 생성합니다.

POST /projects/:id/feature_flags
속성 유형 필수 설명
id 정수 또는 문자열 프로젝트의 ID 또는 URL 인코딩된 경로.
name 문자열 피처 플래그의 이름.
version 문자열 더 이상 사용되지 않음 피처 플래그의 버전. new_version_flag여야 합니다. 레거시 피처 플래그를 생성하려면 생략하세요.
description 문자열 아니오 피처 플래그의 설명.
active 불리언 아니오 플래그의 활성 상태. 기본값은 true.
strategies 전략 JSON 객체 배열 아니오 피처 플래그 전략.
strategies:name JSON 아니오 전략 이름. default, gradualRolloutUserId, userWithId, gitlabUserList가 될 수 있습니다. GitLab 13.5 이상에서는 flexibleRollout도 가능합니다.
strategies:parameters JSON 아니오 전략 파라미터.
strategies:scopes JSON 아니오 전략의 스코프.
strategies:scopes:environment_scope 문자열 아니오 스코프의 환경 범위.
strategies:user_list_id 정수 또는 문자열 아니오 피처 플래그 사용자 목록의 ID. 전략이 gitlabUserList인 경우.
curl "https://gitlab.example.com/api/v4/projects/1/feature_flags" \
     --header "PRIVATE-TOKEN: <your_access_token>" \
     --header "Content-type: application/json" \
     --data @- << EOF
{
  "name": "awesome_feature",
  "version": "new_version_flag",
  "strategies": [{ "name": "default", "parameters": {}, "scopes": [{ "environment_scope": "production" }] }]
}
EOF

응답 예시:

{
  "name": "awesome_feature",
  "description": null,
  "active": true,
  "version": "new_version_flag",
  "created_at": "2020-05-13T19:56:33.119Z",
  "updated_at": "2020-05-13T19:56:33.119Z",
  "scopes": [],
  "strategies": [
    {
      "id": 36,
      "name": "default",
      "parameters": {},
      "scopes": [
        {
          "id": 37,
          "environment_scope": "production"
        }
      ]
    }
  ]
}

피처 플래그 업데이트#

지정된 피처 플래그를 업데이트합니다.

PUT /projects/:id/feature_flags/:feature_flag_name
속성 유형 필수 설명
id 정수 또는 문자열 프로젝트의 ID 또는 URL 인코딩된 경로.
feature_flag_name 문자열 피처 플래그의 현재 이름.
description 문자열 아니오 피처 플래그의 설명.
active 불리언 아니오 플래그의 활성 상태.
name 문자열 아니오 피처 플래그의 새 이름.
strategies 전략 JSON 객체 배열 아니오 피처 플래그 전략.
strategies:id JSON 아니오 피처 플래그 전략 ID.
strategies:name JSON 아니오 전략 이름.
strategies:_destroy 불리언 아니오 true인 경우 전략 삭제.
strategies:parameters JSON 아니오 전략 파라미터.
strategies:scopes JSON 아니오 전략의 스코프.
strategies:scopes:id JSON 아니오 환경 범위 ID.
strategies:scopes:environment_scope 문자열 아니오 스코프의 환경 범위.
strategies:scopes:_destroy 불리언 아니오 true인 경우 스코프 삭제.
strategies:user_list_id 정수 또는 문자열 아니오 피처 플래그 사용자 목록의 ID. 전략이 gitlabUserList인 경우.
curl "https://gitlab.example.com/api/v4/projects/1/feature_flags/awesome_feature" \
     --header "PRIVATE-TOKEN: <your_access_token>" \
     --header "Content-type: application/json" \
     --data @- << EOF
{
  "strategies": [{ "name": "gradualRolloutUserId", "parameters": { "groupId": "default", "percentage": "25" }, "scopes": [{ "environment_scope": "staging" }] }]
}
EOF

응답 예시:

{
  "name": "awesome_feature",
  "description": null,
  "active": true,
  "version": "new_version_flag",
  "created_at": "2020-05-13T20:10:32.891Z",
  "updated_at": "2020-05-13T20:10:32.891Z",
  "scopes": [],
  "strategies": [
    {
      "id": 38,
      "name": "gradualRolloutUserId",
      "parameters": {
        "groupId": "default",
        "percentage": "25"
      },
      "scopes": [
        {
          "id": 40,
          "environment_scope": "staging"
        }
      ]
    },
    {
      "id": 37,
      "name": "default",
      "parameters": {},
      "scopes": [
        {
          "id": 39,
          "environment_scope": "production"
        }
      ]
    }
  ]
}

피처 플래그 삭제#

지정된 피처 플래그를 삭제합니다.

DELETE /projects/:id/feature_flags/:feature_flag_name
속성 유형 필수 설명
id 정수 또는 문자열 프로젝트의 ID 또는 URL 인코딩된 경로.
feature_flag_name 문자열 피처 플래그의 이름.
curl --request DELETE \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/1/feature_flags/awesome_feature"

피처 플래그 API

Tier: Free, Premium, Ultimate
Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
원문 보기
요약

이 API를 사용하여 GitLab 피처 플래그와 상호 작용합니다. 요청한 프로젝트의 모든 피처 플래그를 가져옵니다. page 및 per_page 페이지네이션 파라미터를 사용하여 결과의 페이지네이션을 제어합니다. 지정된 프로젝트에 대한 피처 플래그를 생성합니다.

히스토리
  • GitLab Premium 12.5에서 도입.
  • GitLab Free 13.5로 이동.

이 API를 사용하여 GitLab 피처 플래그와 상호 작용합니다.

사전 요구사항:

  • Developer, Maintainer 또는 Owner 권한이 있어야 합니다.

프로젝트의 피처 플래그 목록 조회#

요청한 프로젝트의 모든 피처 플래그를 가져옵니다.

GET /projects/:id/feature_flags

pageper_page 페이지네이션 파라미터를 사용하여 결과의 페이지네이션을 제어합니다.

속성 유형 필수 설명
id 정수 또는 문자열 프로젝트의 ID 또는 URL 인코딩된 경로.
scope 문자열 아니오 피처 플래그의 조건, enabled, disabled 중 하나.
curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/1/feature_flags"

응답 예시:

[
   {
      "name":"merge_train",
      "description":"This feature is about merge train",
      "active": true,
      "version": "new_version_flag",
      "created_at":"2019-11-04T08:13:51.423Z",
      "updated_at":"2019-11-04T08:13:51.423Z",
      "scopes":[],
      "strategies": [
        {
          "id": 1,
          "name": "userWithId",
          "parameters": {
            "userIds": "user1"
          },
          "scopes": [
            {
              "id": 1,
              "environment_scope": "production"
            }
          ],
          "user_list": null
        }
      ]
   },
   {
      "name":"new_live_trace",
      "description":"This is a new live trace feature",
      "active": true,
      "version": "new_version_flag",
      "created_at":"2019-11-04T08:13:10.507Z",
      "updated_at":"2019-11-04T08:13:10.507Z",
      "scopes":[],
      "strategies": [
        {
          "id": 2,
          "name": "default",
          "parameters": {},
          "scopes": [
            {
              "id": 2,
              "environment_scope": "staging"
            }
          ],
          "user_list": null
        }
      ]
   },
   {
      "name":"user_list",
      "description":"This feature is about user list",
      "active": true,
      "version": "new_version_flag",
      "created_at":"2019-11-04T08:13:10.507Z",
      "updated_at":"2019-11-04T08:13:10.507Z",
      "scopes":[],
      "strategies": [
        {
          "id": 2,
          "name": "gitlabUserList",
          "parameters": {},
          "scopes": [
            {
              "id": 2,
              "environment_scope": "staging"
            }
          ],
          "user_list": {
            "id": 1,
            "iid": 1,
            "name": "My user list",
            "user_xids": "user1,user2,user3"
          }
        }
      ]
   }
]

피처 플래그 조회#

지정된 피처 플래그를 조회합니다.

GET /projects/:id/feature_flags/:feature_flag_name

pageper_page 페이지네이션 파라미터를 사용하여 결과의 페이지네이션을 제어합니다.

속성 유형 필수 설명
id 정수 또는 문자열 프로젝트의 ID 또는 URL 인코딩된 경로.
feature_flag_name 문자열 피처 플래그의 이름.
curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/1/feature_flags/awesome_feature"

응답 예시:

{
  "name": "awesome_feature",
  "description": null,
  "active": true,
  "version": "new_version_flag",
  "created_at": "2020-05-13T19:56:33.119Z",
  "updated_at": "2020-05-13T19:56:33.119Z",
  "scopes": [],
  "strategies": [
    {
      "id": 36,
      "name": "default",
      "parameters": {},
      "scopes": [
        {
          "id": 37,
          "environment_scope": "production"
        }
      ],
      "user_list": null
    }
  ]
}

피처 플래그 생성#

지정된 프로젝트에 대한 피처 플래그를 생성합니다.

POST /projects/:id/feature_flags
속성 유형 필수 설명
id 정수 또는 문자열 프로젝트의 ID 또는 URL 인코딩된 경로.
name 문자열 피처 플래그의 이름.
version 문자열 더 이상 사용되지 않음 피처 플래그의 버전. new_version_flag여야 합니다. 레거시 피처 플래그를 생성하려면 생략하세요.
description 문자열 아니오 피처 플래그의 설명.
active 불리언 아니오 플래그의 활성 상태. 기본값은 true.
strategies 전략 JSON 객체 배열 아니오 피처 플래그 전략.
strategies:name JSON 아니오 전략 이름. default, gradualRolloutUserId, userWithId, gitlabUserList가 될 수 있습니다. GitLab 13.5 이상에서는 flexibleRollout도 가능합니다.
strategies:parameters JSON 아니오 전략 파라미터.
strategies:scopes JSON 아니오 전략의 스코프.
strategies:scopes:environment_scope 문자열 아니오 스코프의 환경 범위.
strategies:user_list_id 정수 또는 문자열 아니오 피처 플래그 사용자 목록의 ID. 전략이 gitlabUserList인 경우.
curl "https://gitlab.example.com/api/v4/projects/1/feature_flags" \
     --header "PRIVATE-TOKEN: <your_access_token>" \
     --header "Content-type: application/json" \
     --data @- << EOF
{
  "name": "awesome_feature",
  "version": "new_version_flag",
  "strategies": [{ "name": "default", "parameters": {}, "scopes": [{ "environment_scope": "production" }] }]
}
EOF

응답 예시:

{
  "name": "awesome_feature",
  "description": null,
  "active": true,
  "version": "new_version_flag",
  "created_at": "2020-05-13T19:56:33.119Z",
  "updated_at": "2020-05-13T19:56:33.119Z",
  "scopes": [],
  "strategies": [
    {
      "id": 36,
      "name": "default",
      "parameters": {},
      "scopes": [
        {
          "id": 37,
          "environment_scope": "production"
        }
      ]
    }
  ]
}

피처 플래그 업데이트#

지정된 피처 플래그를 업데이트합니다.

PUT /projects/:id/feature_flags/:feature_flag_name
속성 유형 필수 설명
id 정수 또는 문자열 프로젝트의 ID 또는 URL 인코딩된 경로.
feature_flag_name 문자열 피처 플래그의 현재 이름.
description 문자열 아니오 피처 플래그의 설명.
active 불리언 아니오 플래그의 활성 상태.
name 문자열 아니오 피처 플래그의 새 이름.
strategies 전략 JSON 객체 배열 아니오 피처 플래그 전략.
strategies:id JSON 아니오 피처 플래그 전략 ID.
strategies:name JSON 아니오 전략 이름.
strategies:_destroy 불리언 아니오 true인 경우 전략 삭제.
strategies:parameters JSON 아니오 전략 파라미터.
strategies:scopes JSON 아니오 전략의 스코프.
strategies:scopes:id JSON 아니오 환경 범위 ID.
strategies:scopes:environment_scope 문자열 아니오 스코프의 환경 범위.
strategies:scopes:_destroy 불리언 아니오 true인 경우 스코프 삭제.
strategies:user_list_id 정수 또는 문자열 아니오 피처 플래그 사용자 목록의 ID. 전략이 gitlabUserList인 경우.
curl "https://gitlab.example.com/api/v4/projects/1/feature_flags/awesome_feature" \
     --header "PRIVATE-TOKEN: <your_access_token>" \
     --header "Content-type: application/json" \
     --data @- << EOF
{
  "strategies": [{ "name": "gradualRolloutUserId", "parameters": { "groupId": "default", "percentage": "25" }, "scopes": [{ "environment_scope": "staging" }] }]
}
EOF

응답 예시:

{
  "name": "awesome_feature",
  "description": null,
  "active": true,
  "version": "new_version_flag",
  "created_at": "2020-05-13T20:10:32.891Z",
  "updated_at": "2020-05-13T20:10:32.891Z",
  "scopes": [],
  "strategies": [
    {
      "id": 38,
      "name": "gradualRolloutUserId",
      "parameters": {
        "groupId": "default",
        "percentage": "25"
      },
      "scopes": [
        {
          "id": 40,
          "environment_scope": "staging"
        }
      ]
    },
    {
      "id": 37,
      "name": "default",
      "parameters": {},
      "scopes": [
        {
          "id": 39,
          "environment_scope": "production"
        }
      ]
    }
  ]
}

피처 플래그 삭제#

지정된 피처 플래그를 삭제합니다.

DELETE /projects/:id/feature_flags/:feature_flag_name
속성 유형 필수 설명
id 정수 또는 문자열 프로젝트의 ID 또는 URL 인코딩된 경로.
feature_flag_name 문자열 피처 플래그의 이름.
curl --request DELETE \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/1/feature_flags/awesome_feature"