Add user keys to the individual target section in existing feature flags
Learn how to add user keys in the individual target section of a given treatment to an existing feature flag using the Admin API.
Overview
Use this script to add user keys in the individual target section of a given treatment to an existing feature flag.
Prerequisites
Install the Python Admin API Wrapper.
You have created an Admin API key from the Harness FME UI.
Configuration
Before running the script, update the following variables in the code:
ADMIN API KEY: Your Admin API key.workspaceName: The name of the workspace.environmentName: The name of the environment.SplitName: The name of the feature flag.treatmentName: The name of the treatment.userIds: A list of user IDs (or keys) to be targeted.
Run this script using Python 3 from your local machine or preferred development environment. The script will determine the treatment order to use in constructing the patch request payload, and checks if an individual target section already exists for the treatment to change the JSON path accordingly.
Next steps
Go to Import thousands of customer keys to an existing segment to import thousands of keys into a segment.
Go to Add a segment to individual targets for a group of feature flags to add a segment to individual targets.
Last updated
Was this helpful?