postExperimentWithHttpInfo method

Future<Response> postExperimentWithHttpInfo(
  1. CreateBody createBody
)

Registers a controlled experiment AND puts its assignment flag live, in that order, so the arms start bucketing subjects the moment this returns 201 — the flag is created active at 100% rollout, with each variant weighted as declared.

Registers a controlled experiment AND puts its assignment flag live, in that order, so the arms start bucketing subjects the moment this returns 201 — the flag is created active at 100% rollout, with each variant weighted as declared. There is no separate start call; creating IS starting. A variant carries an opaque payload this primitive never interprets: a feature config, an ad-creative id, a subject line, a model id. Requires a validated principal, and refuses without one. The org and project are taken from that principal and the creator is stamped from the credential — none of the three is a body field, so an experiment cannot be filed against another tenant. An id already used in this project is a conflict, never a silent overwrite: re-creating would stomp the assignment flag of a run in progress. It fails closed on the flag write. An experiment whose assignment flag does not exist would assign nobody, so if that write fails nothing is registered.

Note: This method returns the HTTP Response.

Parameters:

Implementation

Future<Response> postExperimentWithHttpInfo(CreateBody createBody,) async {
  // ignore: prefer_const_declarations
  final path = r'/v1/experiment';

  // ignore: prefer_final_locals
  Object? postBody = createBody;

  final queryParams = <QueryParam>[];
  final headerParams = <String, String>{};
  final formParams = <String, String>{};

  const contentTypes = <String>['application/json'];


  return apiClient.invokeAPI(
    path,
    'POST',
    queryParams,
    postBody,
    headerParams,
    formParams,
    contentTypes.isEmpty ? null : contentTypes.first,
  );
}