This repo contains API recipes to get started with Optimizely Feature Experimentation (FX). 👩🍳
We'll walk through some of the most common operations in the lifecycle of an experiment using the Optimizely APIs. 🧪
To get started with this API cookbook, first complete the below setup.
We'll be using VS Code as a REST client make requests to the Optimizely APIs. Use the below links to install:
- VS Code
- Rest Client (REST Client for VS Code)
Follow these steps to get a personal access token to the Optimizely APIs.
Next, we'll setup VS Code so we can make requests to the Optimizely APIs.
Let's create some environment variables for the Optimizely API endpoints and your personal access token.
In VS Code, create a directory named .vscode
in the root of your project. In this directory, create a file named settings.json
. Make sure to replace the token
value with your personal access token:
{
"rest-client.environmentVariables": {
"$shared": {
"flagsUrl": "https://api.optimizely.com/flags/v1",
"baseUrl": "https://api.optimizely.com/v2",
"token": "{{yourToken}}",
"projectId": {{yourProjectId}}
}
}
}
You can find more information on adding environment variables here.
Now we'll execute some of the most common operations in the lifecycle of an experiment via the Optimizely APIs, including:
- Create a feature flag and flag variables.
- Create variations.
- Create events.
- Create attributes.
- Create audiences.
- Create an experiment.
- Launch the experiment.
- Conclude the experiment.
- Analyze results.
Each of the above sections has its own .rest
file in the requests
directory of this repo. To execute the requests, open each file in VS Code and click the Send Request
link above the request.
For more information on how to send requests using the REST Client extension, see here.