Movatterモバイル変換


[0]ホーム

URL:


Dev guideRecipesAPI ReferenceChangelog
Dev guideAPI ReferenceRecipesChangelogUser GuideGitHubDev CommunityOptimizely AcademySubmit a ticketLog InFeature Experimentation
Dev guide
All
Pages
Start typing to search…

Create flag variables

Variables let you remotely configure your flag. Instead of hard-coding and updating your variables by re-deploying, you can group them in a flag variation and update them remotely in the Optimizely Feature Experimentation application.

SeeCreate flag variables in the user documentation to see the available variable types, detailed examples, and step-by-step instructions for creating variables using the Feature Experimentation UI.

For a specific use-case example using an image carousel iOS, seeFlag variable example with an image carousel.

Create flag variable

Use the Feature Experimentation REST API

Use theCreate Variable Definitionendpoint.

Endpointhttps://api.optimizely.com/flags/v1/projects/PROJECT_ID/flags/FLAG_KEY/variable_definitions

Authentication – Include your API key in theAuthorization header as a Bearer token. SeeGenerate tokens and use the REST APIs.

Request example

curl --request POST \     --url https://api.optimizely.com/flags/v1/projects/PROJECT_ID/flags/FLAG_KEY/variable_definitions \     --header 'accept: application/json' \     --header 'authorization: Bearer TOKEN' \     --header 'content-type: application/json' \     --data '{  "type": "TYPE",  "default_value": "DEFAULT_VALUE",  "description": "VARIABLE_DESCRIPTION",  "key": "VARIABLE_KEY"}'

Response example

{  "key": "show_amounts",  "description": "If inventory is shown, this variable controls what is displayed: available/unavailable vs the actual inventory amount.",  "type": "boolean",  "default_value": "false",  "created_time": "2025-09-12T16:23:14.258485Z",  "updated_time": "2025-09-12T16:23:14.258487Z",  "role": "admin"}

See theCreate Variable Definition API endpoint reference documentation for information on creating a variable with the Feature Experimentation API. You can also follow theREST API cookbookand seestep three to create a flag variation.

Use the Feature Experimentation UI

SeeCreate flag variables in the user documentation.

Implement variables

After you have created your variables, the next step is tocreate flag variations. Variations let you avoid hard-coding variables in your application and let you group and reuse variable values using flag rules.


Updated 17 days ago



[8]ページ先頭

©2009-2025 Movatter.jp