Movatterモバイル変換


[0]ホーム

URL:


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

Optimizely Agent provides equivalent functionality to the language-specific SDKs. At Optimizely Agent's core is theOptimizely Go SDK.

Run feature flag rules

TheDecide endpoint buckets a user into a feature flag variation as part of aflag rule. It chooses between multiple enabled or one disabled variation for a flag. Flag rules include A/B tests and targeted feature flag deliveries. To run a flag rule, use the following:

POST /v1/decide?keys={flagKey}

In the requestapplication/json body, include theuserId and anydecideOptions. The full request looks like

curl --location --request POST 'http://localhost:8080/v1/decide?keys=YOUR_FLAG_1&keys=YOUR_FLAG_2'--header 'X-Optimizely-SDK-Key: YOUR_SDK_KEY'--header 'Accept: text/event-stream'--header 'Content-Type: application/json'--data-raw '{"decideOptions": [],"userId": "string","userAttributes": {   "additionalProp1": {}  }}'

This returns an array ofOptimizelyDecision objects that contain all the information you need to run your flag rule, such as:

  • The decision to bucket this user into an enabled or disabled feature flag variation.
  • Any corresponding feature flag variable values.

For example:

{"userContext": {        "UserId": "test-user",        "Attributes": {            "logged-in": true,            "location": "usa"        }    },    "flagKey": "my-feature-flag",    "ruleKey": "my-a-b-test",  "enabled": false,    "variationKey": "control_variation""variables": {"my-var-1": "cust-val-default-1","my-var-2": "cust-va1-default-2"},    "reasons": []}

The response is determined by theA/B tests andtargeted deliveries defined for the supplied feature key, following the same rules as any Optimizely Feature Experimentation SDK.

🚧

Important

If the user is bucketed into an A/B test, this endpoint dispatches a decision event.

Authentication

To authenticate, pass your SDK key as a header namedX-Optimizely-SDK-Key in your API calls to Optimizely Agent. You can find your SDK key inapp.optimizely.com underSettings >Environments >SDK Key. Remember each environment has its own SDK key.

Get all decisions

  • To get all feature flag decisions for a visitor in a single request, omit the feature flag parameter:
    POST /v1/decide

  • To get decisions for multiple keys, specify multiple keys parameters, for example:
    keys=flag_key_1&keys=flag_key_2

  • To receive only the enabled feature flags for a visitor use a decide option in theapplication/json request body:

--header 'Content-Type: application/json' \--data-raw '{   "userId": "test-user"   "decideOptions": [      "ENABLED_FLAGS_ONLY"   ]}'

Track conversions

To track events, use thetracking endpoint:

POST /v1/track?eventKey={eventKey}

There is no response body for successful conversion event requests.

API reference

For more details on Optimizely Agent's APIs, see thecomplete Agent API Reference.

Updated 17 days ago



[8]ページ先頭

©2009-2025 Movatter.jp