Select a Winning Variant
Select a winning variant for a completed experiment that had no winner. Once you select a non-control variant as the winning variant, it supersedes the control and becomes the only published story. To complete an experiment and pick the winning variant in a single call, use the complete an experiment with a winning variant endpoint instead.
https://mapi.storyblok.com/v1/spaces/:space_id/experiments/:experiment_id/select_winnerPath parameters
Section titled “Path parameters”-
:space_idrequired numberNumeric ID of a space.
-
:experiment_idrequired numberNumeric ID of the experiment.
Query parameters
Section titled “Query parameters”-
variant_idrequired numberNumeric ID of the winning variant.
Response properties
Section titled “Response properties”-
experimentThe Experiment ObjectThe experiment object with
winning_variant_idset.
Examples
Section titled “Examples”curl "https://mapi.storyblok.com/v1/spaces/288868932106293/experiments/176070002766742/select_winner\?variant_id=176070002791237" \ -X PATCH \ -H "Authorization: YOUR_OAUTH_TOKEN" \ -H "Content-Type: application/json" \ -d "{}"// storyblok-js-client@>=7, node@>=18import Storyblok from "storyblok-js-client";
const storyblok = new Storyblok({ oauthToken: "YOUR_PERSONAL_ACCESS_TOKEN",});
try { const response = await storyblok.patch('spaces/288868932106293/experiments/176070002766742/select_winner?variant_id=176070002791237', {}) console.log({ response })} catch (error) { console.log(error)}$client = new \Storyblok\ManagementClient('YOUR_OAUTH_TOKEN');
$payload = [];
$client->patch('spaces/288868932106293/experiments/176070002766742/select_winner?variant_id=176070002791237', $payload)->getBody();HttpResponse<String> response = Unirest.patch("https://mapi.storyblok.com/v1/spaces/288868932106293/experiments/176070002766742/select_winner?variant_id=176070002791237") .header("Content-Type", "application/json") .header("Authorization", "YOUR_OAUTH_TOKEN") .body({}) .asString();var client = new RestClient("https://mapi.storyblok.com/v1/spaces/288868932106293/experiments/176070002766742/select_winner?variant_id=176070002791237");var request = new RestRequest(Method.PATCH);
request.AddHeader("Content-Type", "application/json");request.AddHeader("Authorization", "YOUR_OAUTH_TOKEN");request.AddParameter("application/json", "{}", ParameterType.RequestBody);IRestResponse response = client.Execute(request);import requests
url = "https://mapi.storyblok.com/v1/spaces/288868932106293/experiments/176070002766742/select_winner"
querystring = {"variant_id":"176070002791237"}
payload = {}headers = { 'Content-Type': "application/json", 'Authorization': "YOUR_OAUTH_TOKEN"}
response = requests.request("PATCH", url, data=payload, headers=headers, params=querystring)
print(response.text)require 'storyblok'client = Storyblok::Client.new(oauth_token: 'YOUR_OAUTH_TOKEN')
payload = {}
client.patch('spaces/288868932106293/experiments/176070002766742/select_winner', {:params => { "variant_id" => "176070002791237"}}, payload)let storyblok = URLSession(storyblok: .mapi(accessToken: .oauth("YOUR_OAUTH_TOKEN")))var request = URLRequest(storyblok: storyblok, path: "spaces/288868932106293/experiments/176070002766742/select_winner")request.url!.append(queryItems: [ URLQueryItem(name: "variant_id", value: "176070002791237")])request.httpMethod = "PATCH"request.httpBody = try JSONSerialization.data(withJSONObject: [ ])let (data, _) = try await storyblok.data(for: request)print(try JSONSerialization.jsonObject(with: data))val client = HttpClient { install(Storyblok(MAPI)) { accessToken = OAuth("YOUR_OAUTH_TOKEN") }}
val response = client.patch("spaces/288868932106293/experiments/176070002766742/select_winner") { url { parameters.append("variant_id", "176070002791237") } setBody(buildJsonObject { })}
println(response.body<JsonElement>())Was this page helpful?
This site uses reCAPTCHA and Google's Privacy Policy (opens in a new window) . Terms of Service (opens in a new window) apply.
Get in touch with the Storyblok community