createExperimentDefinition method
- required String applicationIdentifier,
- required String audienceRule,
- required String configurationProfileIdentifier,
- required TreatmentInput control,
- required String environmentIdentifier,
- required String flagKey,
- required String name,
- required List<
TreatmentInput> treatments, - String? audienceDescription,
- String? hypothesis,
- String? launchCriteria,
- Map<
String, String> ? tags,
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.
May throw BadRequestException.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
Parameter applicationIdentifier :
The application ID or name.
Parameter audienceRule :
A rule that defines which users are eligible to be assigned to treatments
during the experiment.
Parameter configurationProfileIdentifier :
The configuration profile ID or name that stores the feature flag.
Parameter control :
The control treatment that represents the baseline experience for
comparison.
Parameter environmentIdentifier :
The environment ID or name where the experiment will run.
Parameter flagKey :
The key of the existing feature flag to use with the experiment.
Parameter name :
A name for the experiment definition.
Parameter treatments :
A list of treatments to evaluate during the experiment. Each treatment
defines a distinct variation compared to the control.
Parameter audienceDescription :
A description of the intended audience for the experiment.
Parameter hypothesis :
A description of the goal or hypothesis the experiment is designed to
validate.
Parameter launchCriteria :
Information about the conditions under which you would launch the winning
treatment.
Parameter tags :
The tags to assign to the experiment definition. Tags help organize and
categorize your AppConfig resources.
Implementation
Future<ExperimentDefinition> createExperimentDefinition({
required String applicationIdentifier,
required String audienceRule,
required String configurationProfileIdentifier,
required TreatmentInput control,
required String environmentIdentifier,
required String flagKey,
required String name,
required List<TreatmentInput> treatments,
String? audienceDescription,
String? hypothesis,
String? launchCriteria,
Map<String, String>? tags,
}) async {
final $payload = <String, dynamic>{
'AudienceRule': audienceRule,
'ConfigurationProfileIdentifier': configurationProfileIdentifier,
'Control': control,
'EnvironmentIdentifier': environmentIdentifier,
'FlagKey': flagKey,
'Name': name,
'Treatments': treatments,
if (audienceDescription != null)
'AudienceDescription': audienceDescription,
if (hypothesis != null) 'Hypothesis': hypothesis,
if (launchCriteria != null) 'LaunchCriteria': launchCriteria,
if (tags != null) 'Tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/applications/${Uri.encodeComponent(applicationIdentifier)}/experimentdefinitions',
exceptionFnMap: _exceptionFns,
);
return ExperimentDefinition.fromJson(response);
}