Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSON Body for "AddUserTargets" Patch Request

Tags:

launchdarkly

I'm attempting to patch a feature flag via the API, adding an individual target to the flag following the documentation for patching feature flags.

Targeting an API route of https://app.launchdarkly.com/api/v2/flags/foo/bar

Where bar is a boolean flag, I'm using the body:

{
    "instructions":[{"kind": "addUserTargets", "values":["[email protected]"],"variationId": "True"}],
    "environmentKey": "development"
}

I am receiving a return of

enter image description here

What am I doing wrong in my request body? I haven't been able to find the variationId through the Darkly UI

Edit: Proof of Proper Headers - enter image description here

like image 532
JeffK3 Avatar asked Sep 19 '25 13:09

JeffK3


1 Answers

Looking at it further, it appears that you are in fact missing the variation ID on the flag you are attempting to patch, which is a required field.

You would need to make a request to gather that data as described here and then modify your request accordingly.

like image 161
alm0st907 Avatar answered Sep 23 '25 11:09

alm0st907



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!