Palbase Flags · API
/flags/experiments/{experiment_id}/winnerDeclare an experiment's winner
Ends a running experiment with a winner: its value becomes the flag's default — or, as_rule (an experiment for an audience), the first of the flag's conditions, server.audience == the audience, and the default stays. With publishing on, that is the next published version (its note names the experiment). Every reader is told (flags:<ref>).
Called by your server, with the project's secret key.
Path
experiment_idstring (uuid) · requiredThe experiment's id.Request body
as_ruleboolean · optionalRoll it out as a condition at the top of the flag's — server.audience == the experiment's audience — and keep the flag's default; for an experiment for an audience only. Absent or false: its value becomes the flag's default.variantstring · requiredThe variant's key.curl -X POST "https://<your-ref>.palbase.studio/flags/experiments/<experiment_id>/winner" \
-H "apikey: $PALBASE_SECRET_KEY" \
-H "content-type: application/json" \
-d '{"variant":"string"}'Responses
200The experiment, won
400The request is malformed, or a definition or a value breaks a flag's rules (the error names which)
401No key, or not a key of this project, or a token that is not valid (the edge's answer)
403Not the project's secret key
404No such experiment (`experiment_not_found`)
409The experiment has ended (`experiment_ended`)
422The experiment has no such variant (`unknown_variant`); as_rule for an experiment for everyone (`as_rule_needs_audience`); the flag already has 8 conditions (`invalid_conditions`)
429The project's request rate, or its flag reads for the period under its quota, are used up; Retry-After says when to try again
503The platform could not answer now; retrying is safe (Retry-After)
defaultAn error: the envelope names it (`error`) and explains it (`error_description`).
Operation DeclareExperimentWinner of flags's contract.