createExperimentDefinition

Creates an experiment definition in AppConfig. An experiment definition describes the purpose, scope, and operational configuration of an experiment, including the target audience, feature flag, and treatment configurations.

Samples

// The following CreateExperimentDefinition example creates an experiment definition that tests a
// feature flag with a 50 50 traffic split.
val resp = appConfigClient.createExperimentDefinition {
    applicationIdentifier = "339ohji"
    configurationProfileIdentifier = "ur8hx2f"
    environmentIdentifier = "54j1r29"
    name = "Example-Experiment-Definition"
    flagKey = "my-feature-flag"
    treatments = listOf<TreatmentInput>(
        TreatmentInput {
            weight = 50.toFloat()
            flagValue = FlagValue {
                enabled = true
            }
        }            
    )
    control = TreatmentInput {
        weight = 50.toFloat()
        flagValue = FlagValue {
            enabled = false
        }
    }
    audienceRule = "(eq $country \"US\")"
}