Perform a partial update to an AI Config’s targeting. The request body must be a valid semantic patch.
To make a semantic patch request, you must append domain-model=launchdarkly.semanticpatch
to your Content-Type
header. To learn more, read Updates using semantic patch.
The body of a semantic patch request for updating an AI Config’s targeting takes the following properties:
comment
(string): (Optional) A description of the update.environmentKey
(string): The key of the LaunchDarkly environment.instructions
(array): (Required) A list of actions the update should perform. Each action in the list must be an object with a kind
property that indicates the instruction. If the action requires parameters, you must include those parameters as additional fields in the object. The body of a single semantic patch can contain many different instructions.Semantic patch requests support the following kind
instructions for updating AI Configs.
Adds the given clauses to the rule indicated by ruleId
.
ruleId
: ID of a rule in the AI Config.clauses
: Array of clause objects, with contextKind
(string), attribute
(string), op
(string), negate
(boolean), and values
(array of strings, numbers, or dates) properties. The contextKind
, attribute
, and values
are case sensitive. The op
must be lower-case.Here’s an example:
Adds a new targeting rule to the AI Config. The rule may contain clauses
and serve the variation that variationId
indicates, or serve a percentage rollout that rolloutWeights
, rolloutBucketBy
, and rolloutContextKind
indicate.
If you set beforeRuleId
, this adds the new rule before the indicated rule. Otherwise, adds the new rule to the end of the list.
clauses
: Array of clause objects, with contextKind
(string), attribute
(string), op
(string), negate
(boolean), and values
(array of strings, numbers, or dates) properties. The contextKind
, attribute
, and values
are case sensitive. The op
must be lower-case.beforeRuleId
: (Optional) ID of a rule.variationId
: ID of a variation.or
rolloutWeights
: (Optional) Map of variationId
to weight, in thousandths of a percent (0-100000).rolloutBucketBy
: (Optional) Context attribute available in the specified rolloutContextKind
.rolloutContextKind
: (Optional) Context kind, defaults to user
Here’s an example that uses a variationId
:
Here’s an example that uses a percentage rollout:
Adds context keys to the individual context targets for the context kind that contextKind
specifies and the variation that variationId
specifies. Returns an error if this causes the AI Config to target the same context key in multiple variations.
values
: List of context keys.contextKind
: (Optional) Context kind to target, defaults to user
variationId
: ID of a variation.Here’s an example:
Adds values
to the values of the clause that ruleId
and clauseId
indicate. Does not update the context kind, attribute, or operator.
ruleId
: ID of a rule in the AI Config.clauseId
: ID of a clause in that rule.values
: Array of strings, case sensitive.Here’s an example:
Removes all individual targets from the variation that variationId
specifies. This includes both user and non-user targets.
variationId
: ID of a variation.Here’s an example:
Removes the clauses specified by clauseIds
from the rule indicated by ruleId
.
ruleId
: ID of a rule.clauseIds
: Array of IDs of clauses in the rule.Here’s an example:
Removes the targeting rule specified by ruleId
. Does nothing if the rule does not exist.
ruleId
: ID of a rule.Here’s an example:
Removes context keys from the individual context targets for the context kind that contextKind
specifies and the variation that variationId
specifies. Does nothing if the flag does not target the context keys.
values
: List of context keys.contextKind
: (Optional) Context kind to target, defaults to user
variationId
: ID of a variation.Here’s an example:
Removes values
from the values of the clause indicated by ruleId
and clauseId
. Does not update the context kind, attribute, or operator.
ruleId
: ID of a rule.clauseId
: ID of a clause in that rule.values
: Array of strings, case sensitive.Here’s an example:
Rearranges the rules to match the order given in ruleIds
. Returns an error if ruleIds
does not match the current set of rules on the AI Config.
ruleIds
: Array of IDs of all rules.Here’s an example:
Removes all targeting rules for the AI Config and replaces them with the list you provide.
rules
: A list of rules.Here’s an example:
Removes all existing targeting and replaces it with the list of targets you provide.
targets
: A list of context targeting. Each item in the list includes an optional contextKind
that defaults to user
, a required variationId
, and a required list of values
.Here’s an example:
Replaces the clause indicated by ruleId
and clauseId
with clause
.
ruleId
: ID of a rule.clauseId
: ID of a clause in that rule.clause
: New clause
object, with contextKind
(string), attribute
(string), op
(string), negate
(boolean), and values
(array of strings, numbers, or dates) properties. The contextKind
, attribute
, and values
are case sensitive. The op
must be lower-case.Here’s an example:
Updates the default on or off variation of the AI Config.
onVariationValue
: (Optional) The value of the variation of the new on variation.offVariationValue
: (Optional) The value of the variation of the new off variationHere’s an example:
Updates the default or “fallthrough” rule for the AI Config, which the AI Config serves when a context matches none of the targeting rules. The rule can serve either the variation that variationId
indicates, or a percentage rollout that rolloutWeights
and rolloutBucketBy
indicate.
variationId
: ID of a variation.or
rolloutWeights
: Map of variationId
to weight, in thousandths of a percent (0-100000).rolloutBucketBy
: (Optional) Context attribute available in the specified rolloutContextKind
.rolloutContextKind
: (Optional) Context kind, defaults to user
Here’s an example that uses a variationId
:
Here’s an example that uses a percentage rollout:
Updates the default off variation to variationId
. The AI Config serves the default off variation when the AI Config’s targeting is Off.
variationId
: ID of a variation.Here’s an example:
Updates the description of the targeting rule.
description
: The new human-readable description for this rule.ruleId
: The ID of the rule. You can retrieve this by making a GET request for the AI Config.Here’s an example:
Updates whether or not LaunchDarkly tracks events for the AI Config associated with this rule.
ruleId
: The ID of the rule. You can retrieve this by making a GET request for the AI Config.trackEvents
: Whether or not events are tracked.Here’s an example:
Updates what ruleId
serves when its clauses evaluate to true. The rule can serve either the variation that variationId
indicates, or a percent rollout that rolloutWeights
and rolloutBucketBy
indicate.
ruleId
: ID of a rule.variationId
: ID of a variation.or
rolloutWeights
: Map of variationId
to weight, in thousandths of a percent (0-100000).rolloutBucketBy
: (Optional) Context attribute available in the specified rolloutContextKind
.rolloutContextKind
: (Optional) Context kind, defaults to user
Here’s an example:
Updates whether or not LaunchDarkly tracks events for the AI Config, for all rules.
trackEvents
: Whether or not events are tracked.Here’s an example:
Updates whether or not LaunchDarkly tracks events for the AI Config, for the default rule.
trackEvents
: Whether or not events are tracked.Here’s an example: