Launch experiment
// -------------------------------------------------------------------------- //
// Launch experiment. //
// -------------------------------------------------------------------------- //
// ------------------------------- Enable Flag ------------------------------ //
POST {{flagsUrl}}/projects/{{projectId}}/flags/{{flagKey}}/environments/{{environment}}/ruleset/enabled
Authorization: {{token}}
###
// ---------------------------- Launch Experiment --------------------------- //
PATCH {{flagsUrl}}/projects/{{projectId}}/flags/{{flagKey}}/environments/{{environment}}/ruleset
Content-Type: application/json
Authorization: {{token}}
[{"op":"replace","path":"/rules/stock_message_test/enabled","value":true}]Use the Enable the Ruleset for a Flag in an Environment API endpoint to launch your A/B test.
Prerequisite
Before running this request, you must follow the instructions to configure your REST API cookbook.
Create a file
Create a file named launch-experiment.rest and copy and paste the recipe into the file.
Enable flag
{{flagsUrl}}, {{projectId}}, {{flagKey}}, {{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.
POST {{flagsUrl}}/projects/{{projectId}}/flags/{{flagKey}}/environments/{{environment}}/ruleset/enabled
Authorization: {{token}}The ### delimiter
The REST Client extension delimits multiple requests using ###. See Main features in the REST Client documentation.
Launch experiment
{{flagsUrl}}, {{projectId}}, {{flagKey}}, {{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.
PATCH {{flagsUrl}}/projects/{{projectId}}/flags/{{flagKey}}/environments/{{environment}}/ruleset
Content-Type: application/json
Authorization: {{token}}Launch experiment body
- op (operation) – This is a replace.
- path – A JSON-Pointer to the resource or the resource attribute.
- value – Replace to true.
Click Send Request in Visual Studio Code.
[{"op":"replace","path":"/rules/stock_message_test/enabled","value":true}]Example screenshot
After running the two API requests, your UI should look similar: