Analyze results
// -------------------------------------------------------------------------- //
// Analyze results. //
// -------------------------------------------------------------------------- //
// ----------- Get All Experiments in Project => Get Experiment Key ---------- //
GET {{flagsUrl}}/projects/{{projectId}}/rules?rule_types=a/b,mab&archived=false&environments={{environment}}&per_page=100
Content-Type: application/json
Authorization: {{token}}
// Copy the relevant experiment key from the response, if you do not already have it (for example, stock_message_test).
###
// ------------------------- Get Experiment Reports => Get Report Key ------------------------- //
GET {{flagsUrl}}/projects/{{projectId}}/environments/{{environment}}/reports?sort=key:asc&archived=false
Content-Type: application/json
Authorization: {{token}}
// Copy the relevant report key for the experiment of interest (for example, stock_message_test_ff8g3hxNc8EKoE837vVVtR)
###
// -------------------- Get Individual Experiment Report => Get Experiment Results ID -------------------- //
// Replace {{reportKey}} with the report key from the previous response.
GET {{flagsUrl}}/projects/{{projectId}}/environments/{{environment}}/reports/{{reportKey}}
Content-Type: application/json
Authorization: {{token}}
// Copy the relevant experiment results ID from the end of the fetch_results_ui_url key in the response (/experiments/{{experimentResultsId}})
###
// ------------------------- Get Experiment Results ------------------------- //
// Replace {{experimentResultsId}} with the experiment results ID from the previous response.
GET {{baseUrl}}/experiments/{{experimentResultsId}}/results
Content-Type: application/json
Authorization: {{token}}Use the List rules, List reports, Fetch a Single Report, and the Get Experiment results API endpoints to get the A/B test's result.
Prerequisite
Before running this request, you must follow the instructions to configure your REST API cookbook.
Create a file
Create a file named analyze-results.rest and copy and paste the recipe into the file.
Copy the experiment key
To get the experiment key (if you do not already have it), make a request to the List rules API endpoint. Copy the experiment key for the next step.
{{flagsUrl}}, {{projectId}}, {{environment}}, and {{token}} are defined in the settings.json file. Ensure you have configured your Visual Studio Code project correctly. See Configure the Visual Studio Code REST Client.
Click Send Request in Visual Studio Code.
GET {{flagsUrl}}/projects/{{projectId}}/rules?rule_types=a/b,mab&archived=false&environments={{environment}}&per_page=100
Content-Type: application/json
Authorization: {{token}}
// Copy the relevant experiment key from the response, if you do not already have it (for example, stock_message_test).The ### delimiter
The REST Client extension delimits multiple requests using ###. See Main features in the REST Client documentation.
Copy the report key
To get the report key for the experiment you created in the Create experiment recipe, make a request to the List reports API endpoint.
Click Send Request in Visual Studio Code.
The List reports API endpoint returns an items array. Look for the key-value pair with the key key and copy the value. This is your report key.
Copy the report key for the next step.
GET {{flagsUrl}}/projects/{{projectId}}/environments/{{environment}}/reports?sort=key:asc&archived=false
Content-Type: application/json
Authorization: {{token}}
// Copy the relevant report key for the experiment of interest (for example, stock_message_test_ff8g3hxNc8EKoE837vVVtR)Copy the relevant results ID
Use the Fetch a Single Report API endpoint with the report key from the previous call. Copy the experiment results ID from the end of the fetch_results_ui_url key in the response.
Click Send Request in Visual Studio Code.
{{flagsUrl}}, {{projectId}}, {{environment}}, and {{token}} are defined in the settings.json file. Ensure you have configured your Visual Studio Code project correctly. See Configure the Visual Studio Code REST Client.
// Replace {{reportKey}} with the report key from the previous response.
GET {{flagsUrl}}/projects/{{projectId}}/environments/{{environment}}/reports/{{reportKey}}
Content-Type: application/json
Authorization: {{token}}
// Copy the relevant experiment results ID from the end of the fetch_results_ui_url key in the response (/experiments/{{experimentResultsId}})Get the experiment results
Use the Get Experiment results API endpoint with the experiment results ID from the previous call to get the A/B test's result.
Click Send Request in Visual Studio Code.
{{baseUrl}} and {{token}} are defined in the settings.json file. Ensure you have configured your Visual Studio Code project correctly. See Configure the Visual Studio Code REST Client.
// Replace {{experimentResultsId}} with the experiment results ID from the previous response.
GET {{baseUrl}}/experiments/{{experimentResultsId}}/results
Content-Type: application/json
Authorization: {{token}}