startExperimentRun method
Starts an experiment run for the specified experiment definition. An experiment run delivers treatments to the target audience and collects metrics. You can start multiple experiment runs from the same experiment definition.
May throw BadRequestException.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
Parameter applicationIdentifier :
The application ID or name.
Parameter experimentDefinitionIdentifier :
The experiment definition ID or name.
Parameter deploymentParameters :
The deployment parameters for the experiment run, including a KMS key
identifier for encryption.
Parameter description :
A description of this experiment run.
Parameter exposurePercentage :
The percentage of the target audience to expose to treatments. Set to 0 to
validate the experiment before exposing production users.
Parameter tags :
The tags to assign to the experiment run.
Parameter treatmentOverrides :
Treatment assignment overrides that assign specific entity IDs to
treatments directly, bypassing random assignment.
Implementation
Future<ExperimentRun> startExperimentRun({
required String applicationIdentifier,
required String experimentDefinitionIdentifier,
DeploymentParameters? deploymentParameters,
String? description,
double? exposurePercentage,
Map<String, String>? tags,
TreatmentOverrides? treatmentOverrides,
}) async {
_s.validateNumRange(
'exposurePercentage',
exposurePercentage,
0.0,
100.0,
);
final $payload = <String, dynamic>{
if (deploymentParameters != null)
'DeploymentParameters': deploymentParameters,
if (description != null) 'Description': description,
if (exposurePercentage != null)
'ExposurePercentage': _s.encodeJsonDouble(exposurePercentage),
if (tags != null) 'Tags': tags,
if (treatmentOverrides != null) 'TreatmentOverrides': treatmentOverrides,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/applications/${Uri.encodeComponent(applicationIdentifier)}/experimentdefinitions/${Uri.encodeComponent(experimentDefinitionIdentifier)}/experimentruns',
exceptionFnMap: _exceptionFns,
);
return ExperimentRun.fromJson(response);
}