curl --request PUT \
--url http://localhost:3000/projects/{projectId}/envs/{envId}/flags/{flagId}/targeting-rules/{ruleId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"kind": "segment",
"conditions": [
{
"attribute": "<string>",
"operator": "eq",
"value": "<string>",
"logical_op": "AND"
}
],
"segment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"variation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"rollout_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"order_index": 123
}
'{
"statusCode": 123,
"message": "OK",
"data": {
"rule": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"flag_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"environment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"kind": "segment",
"conditions": [
{
"attribute": "<string>",
"operator": "eq",
"value": "<string>",
"logical_op": "AND"
}
],
"order_index": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"segment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"variation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"rollout_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"deleted_at": "2023-11-07T05:31:56Z",
"segment_name": "<string>",
"segment_description": "<string>",
"segment_rules": [
{
"attribute": "<string>",
"operator": "eq",
"value": "<string>",
"logical_op": "AND"
}
],
"segment_logical_op": "<string>",
"segment_key": "<string>",
"segment": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"rules": [
{
"type": "rule",
"attribute": "<string>",
"operator": "eq",
"value": "<string>"
}
],
"logical_op": "AND",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"force": false,
"key": "<string>"
}
},
"message": "<string>"
}
}Update an existing targeting rule.
Access: Org Admins or Editors only.
Note: Partial updates are supported. Only provide fields you want to change.
Important:
curl --request PUT \
--url http://localhost:3000/projects/{projectId}/envs/{envId}/flags/{flagId}/targeting-rules/{ruleId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"kind": "segment",
"conditions": [
{
"attribute": "<string>",
"operator": "eq",
"value": "<string>",
"logical_op": "AND"
}
],
"segment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"variation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"rollout_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"order_index": 123
}
'{
"statusCode": 123,
"message": "OK",
"data": {
"rule": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"flag_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"environment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"kind": "segment",
"conditions": [
{
"attribute": "<string>",
"operator": "eq",
"value": "<string>",
"logical_op": "AND"
}
],
"order_index": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"segment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"variation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"rollout_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"deleted_at": "2023-11-07T05:31:56Z",
"segment_name": "<string>",
"segment_description": "<string>",
"segment_rules": [
{
"attribute": "<string>",
"operator": "eq",
"value": "<string>",
"logical_op": "AND"
}
],
"segment_logical_op": "<string>",
"segment_key": "<string>",
"segment": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"rules": [
{
"type": "rule",
"attribute": "<string>",
"operator": "eq",
"value": "<string>"
}
],
"logical_op": "AND",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"description": "<string>",
"force": false,
"key": "<string>"
}
},
"message": "<string>"
}
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Human-readable name for the rule
Type of rule: segment-based or custom conditions
segment Required when kind="custom". Array of conditions (AND semantics)
Show child attributes
ID of flag_variations row when this rule matches.
ID of flag_rollouts row to use when this rule matches.
Order in which rules are evaluated (lower = higher priority). Defaults to 0