Flag triggers

Update flag trigger

PATCH
/api/v2/flags/{projectKey}/{featureFlagKey}/triggers/{environmentKey}/{id}

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.

Instructions

Semantic patch requests support the following kind instructions for updating flag triggers.

replaceTriggerActionInstructions

Removes the existing trigger action and replaces it with the new instructions.

Parameters
  • value: An array of the new kinds 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:

{  "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:

{  "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:

{  "instructions": [{ "kind": "disableTrigger" }]}

enableTrigger

Enables the trigger. If you previously disabled the trigger, it begins running again.

Here's an example:

{  "instructions": [{ "kind": "enableTrigger" }]}

Authorization

ApiKey read, write
Authorization<token>

In: header

Scope: read, write

Path Parameters

projectKey*string

The project key

Formatstring
environmentKey*string

The environment key

Formatstring
featureFlagKey*string

The feature flag key

Formatstring
id*string

The flag trigger ID

Formatstring

Request Body

application/json

comment?string

Optional comment describing the update

instructions?array<>

The instructions to perform when updating. This should be an array with objects that look like {"kind": "trigger_action"}.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X PATCH "https://example.com/api/v2/flags/string/string/triggers/string/string" \  -H "Content-Type: application/json" \  -d '{}'
{  "_id": "12ab3c45de678910abc12345",  "_version": 1,  "_creationDate": "1654104600000",  "_maintainerId": "12ab3c45de678910abc12345",  "_maintainer": {    "_links": {      "self": {        "href": "/api/v2/members/569f183514f4432160000007",        "type": "application/json"      }    },    "_id": "569f183514f4432160000007",    "firstName": "Ariel",    "lastName": "Flores",    "role": "admin",    "email": "ariel@acme.com"  },  "enabled": true,  "_status": "active",  "_lastFailedAt": "1654114600000",  "_integrationKey": "generic-trigger",  "instructions": "[ { \"kind\": \"turnFlagOn\" }]",  "_lastTriggeredAt": "1654114600000",  "_recentTriggerBodies": [    {      "timestamp": "1654104600000",      "jsonBody": {        "property1": null,        "property2": null      }    }  ],  "_triggerCount": 3,  "triggerURL": "string",  "_links": {    "property1": {      "href": "string",      "type": "string"    },    "property2": {      "href": "string",      "type": "string"    }  }}