provider Flag triggers PATCH
/api/v2/flags/{projectKey}/{featureFlagKey}/triggers/{environmentKey}/{id} @utdk/launchdarkly
/api/v2/flags/{projectKey}/{featureFlagKey}/triggers/{environmentKey}/{id} Update flag trigger
Update a flag trigger. Updating a flag trigger uses the semantic patch format.
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](https://launchdarkly.com/docs/api#updates-using-semantic-patch).
### Instructions
Semantic patch requests support the following `kind` instructions for updating flag triggers.
<details>
<summary>Click to expand instructions for <strong>updating flag triggers</strong></summary>
#### replaceTriggerActionInstructions
Removes the existing trigger action and replaces it with the new instructions.
##### Parameters
- `value`: An array of the new `kind`s of actions to perform when triggering. Supported flag actions are `turnFlagOn` and `turnFlagOff`.
Here's an example that replaces the existing action with new instructions to turn flag targeting off:
```json
{
"instructions": [
{
"kind": "replaceTriggerActionInstructions",
"value": [ {"kind": "turnFlagOff"} ]
}
]
}
```
#### cycleTriggerUrl
Generates a new URL for this trigger. You must update any clients using the trigger to use this new URL.
Here's an example:
```json
{
"instructions": [{ "kind": "cycleTriggerUrl" }]
}
```
#### disableTrigger
Disables the trigger. This saves the trigger configuration, but the trigger stops running. To re-enable, use `enableTrigger`.
Here's an example:
```json
{
"instructions": [{ "kind": "disableTrigger" }]
}
```
#### enableTrigger
Enables the trigger. If you previously disabled the trigger, it begins running again.
Here's an example:
```json
{
"instructions": [{ "kind": "enableTrigger" }]
}
```
</details>
- projectKey path required
- The project key
- string
- environmentKey path required
- The environment key
- string
- featureFlagKey path required
- The feature flag key
- string
- id path required
- The flag trigger ID
- string
Try it
Authentication
Configure credentials for LaunchDarkly REST API
Gateway
The gateway proxies requests and injects credentials server-side. Configure credentials above, then enter your gateway URL.
Saved automatically to browser storage.
Code snippet
Updates live as you fill in the form above.
TypeScript
import launchdarkly from '@utdk/launchdarkly';
await launchdarkly.patchtriggerworkflow()