Experiments

Get Experiments

Returns all experiments

Node cURL Ruby Python Java C# Go
var request = require("request");

var options = {
  method: 'GET',
  url: 'https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments',
  headers: {
    accept: 'application/json',
    authorization: 'Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6'
  }
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
curl --request GET \
  --url https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments \
  --header 'accept: application/json' \
  --header 'authorization: Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6'
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
request["authorization"] = 'Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6'

response = http.request(request)
puts response.read_body
import requests

url = "https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments"

headers = {
    'accept': "application/json",
    'authorization': "Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6"
    }

response = requests.request("GET", url, headers=headers)

print(response.text)
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments")
  .get()
  .addHeader("accept", "application/json")
  .addHeader("authorization", "Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6")
  .build();

Response response = client.newCall(request).execute();
var client = new RestClient("https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments");
var request = new RestRequest(Method.GET);
request.AddHeader("accept", "application/json");
request.AddHeader("authorization", "Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6");
IRestResponse response = client.Execute(request);
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "application/json")
	req.Header.Add("authorization", "Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

PATH PARAMS

  • applicationId string - The application id

  • environmentName string - The name of the environment

Experiment response

Response schema type: array of objects

  • String apiVersion - Yaml api version

  • String type - Type of the yaml object, have to be experiment

  • String flag - The flag being controlled by this experiment

    • availableValues - The available values that this flag can be

  • String name - The name of the experiment

  • String description - The description of the experiment

  • Boolean enabled - Indicates if the experiment is active

    • labels - Experiment labels

  • String stickinessProperty - Stickiness property that controls percentage based tossing

  • [Object] platforms

    • String platforms[].name - Name of the platform, as defined in the SDK running

    • String platforms[].flag - Override the flag name, when needed

  • [Object] platforms[].conditions - Condition and values for this platform

    • Object platforms[].conditions[].dependency - Condition this flag value with another flag value

    • Object platforms[].conditions[].group - Condition flag value based on target group(s)

    • Object platforms[].conditions[].version - Condition flag value based release version

    • Object platforms[].conditions[].value

    • platforms[].value

  • [Object] conditions

    • Object conditions[].dependency - Condition this flag value with another flag value

    • String conditions[].dependency.flag - Flag name

    • conditions[].dependency.value

    • Object conditions[].group - Condition flag value based on target group(s)

    • String conditions[].group.operator - The logical relationship between the groups

    • conditions[].group.name - Name of target groups

  • Object conditions[].version - Condition flag value based release version

    • String conditions[].version.operator - The operator to compare version

    • String conditions[].version.semver - The version to compare to

    • conditions[].value - Value when no Condition is met

Create an Experiment

Add a new experiment or override existing one

Node cURL Ruby Python Java C# Go
var request = require("request");

var options = {
  method: 'PUT',
  url: 'https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments',
  headers: {
    'content-type': 'application/json',
    authorization: 'Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6'
  },
  body: {
    type: 'experiment',
    apiVersion: '1.0',
    flag: 'acmeFlagControl',
    name: 'acmeExperimentFoo',
    description: 'Applies foo to our Nifty App',
    enabled: true,
    labels: 'do-not-merge',
    stickinessProperty: 'fixed'
  },
  json: true
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
curl --request PUT \
  --url https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments \
  --header 'authorization: Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6' \
  --header 'content-type: application/json' \
  --data '{"type":"experiment","apiVersion":"1.0","flag":"acmeFlagControl","name":"acmeExperimentFoo","description":"Applies foo to our Nifty App","enabled":true,"labels":"do-not-merge","stickinessProperty":"fixed"}'
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6'
request.body = "{\"type\":\"experiment\",\"apiVersion\":\"1.0\",\"flag\":\"acmeFlagControl\",\"name\":\"acmeExperimentFoo\",\"description\":\"Applies foo to our Nifty App\",\"enabled\":true,\"labels\":\"do-not-merge\",\"stickinessProperty\":\"fixed\"}"

response = http.request(request)
puts response.read_body
import requests

url = "https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments"

payload = "{\"type\":\"experiment\",\"apiVersion\":\"1.0\",\"flag\":\"acmeFlagControl\",\"name\":\"acmeExperimentFoo\",\"description\":\"Applies foo to our Nifty App\",\"enabled\":true,\"labels\":\"do-not-merge\",\"stickinessProperty\":\"fixed\"}"
headers = {
    'content-type': "application/json",
    'authorization': "Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6"
    }

response = requests.request("PUT", url, data=payload, headers=headers)

print(response.text)
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"type\":\"experiment\",\"apiVersion\":\"1.0\",\"flag\":\"acmeFlagControl\",\"name\":\"acmeExperimentFoo\",\"description\":\"Applies foo to our Nifty App\",\"enabled\":true,\"labels\":\"do-not-merge\",\"stickinessProperty\":\"fixed\"}");
Request request = new Request.Builder()
  .url("https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments")
  .put(body)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6")
  .build();

Response response = client.newCall(request).execute();
var client = new RestClient("https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments");
var request = new RestRequest(Method.PUT);
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6");
request.AddParameter("application/json", "{\"type\":\"experiment\",\"apiVersion\":\"1.0\",\"flag\":\"acmeFlagControl\",\"name\":\"acmeExperimentFoo\",\"description\":\"Applies foo to our Nifty App\",\"enabled\":true,\"labels\":\"do-not-merge\",\"stickinessProperty\":\"fixed\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments"

	payload := strings.NewReader("{\"type\":\"experiment\",\"apiVersion\":\"1.0\",\"flag\":\"acmeFlagControl\",\"name\":\"acmeExperimentFoo\",\"description\":\"Applies foo to our Nifty App\",\"enabled\":true,\"labels\":\"do-not-merge\",\"stickinessProperty\":\"fixed\"}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("content-type", "application/json")
	req.Header.Add("authorization", "Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

PATH PARAMS

  • applicationId string - The application id

  • environmentName* string - The name of the environment that the experiment belongs to

BODY PARAMS

  • apiVersion string - Yaml api version

  • type* string - type of the yaml object, have to be experiment

  • flag string - The flag being controlled by this experiment

  • availableValues - The available values that this flag can be array of strings, booleans, or numbers

  • name string - The name of the experiment

  • description string - The description of the experiment

  • enabled boolean - Indicates if the experiment is active

  • labels - Experiment labels string or array of strings

  • stickinessProperty string - Stickiness property that controls percentage based tossing

  • platforms array

  • conditions array

value (can be boolean, string, float, array) - Value when no Condition is met

Get Experiment

Returns experiment configuration by its flag name

Node cURL Ruby Python Java C# Go
var request = require("request");

var options = {
  method: 'GET',
  url: 'https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments/acmeFlagControl',
  headers: {
    accept: 'application/json',
    authorization: 'Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6'
  }
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
curl --request GET \
  --url https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments/acmeFlagControl \
  --header 'accept: application/json' \
  --header 'authorization: Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6'
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments/acmeFlagControl")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
request["authorization"] = 'Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6'

response = http.request(request)
puts response.read_body
import requests

url = "https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments/acmeFlagControl"

headers = {
    'accept': "application/json",
    'authorization': "Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6"
    }

response = requests.request("GET", url, headers=headers)

print(response.text)
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments/acmeFlagControl")
  .get()
  .addHeader("accept", "application/json")
  .addHeader("authorization", "Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6")
  .build();

Response response = client.newCall(request).execute();
var client = new RestClient("https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments/acmeFlagControl");
var request = new RestRequest(Method.GET);
request.AddHeader("accept", "application/json");
request.AddHeader("authorization", "Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6");
IRestResponse response = client.Execute(request);
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments/acmeFlagControl"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "application/json")
	req.Header.Add("authorization", "Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

PATH PARAMS

  • applicationId string - The application id

  • environmentName string - The name of the environment that the experiment belongs to

  • flagName string - flag of the experiment

Experiment response

Response schema type: object

  • String apiVersion - Yaml api version

  • String type - Type of the yaml object, have to be experiment

  • String flag - The flag being controlled by this experiment

    • availableValues - The available values that this flag can be

  • String name - The name of the experiment

  • String description - The description of the experiment

  • Boolean enabled - Indicates if the experiment is active

    • labels - Experiment labels

  • String stickinessProperty - Stickiness property that controls percentage based tossing

  • [Object] platforms

    • String platforms[].name - Name of the platform, as defined in the SDK running

    • String platforms[].flag - Override the flag name, when needed

  • [Object] platforms[].conditions - Condition and values for this platform

    • Object platforms[].conditions[].dependency - Condition this flag value with another flag value

    • Object platforms[].conditions[].group - Condition flag value based on target group(s)

    • Object platforms[].conditions[].version - Condition flag value based release version

    • Object platforms[].conditions[].value

    • platforms[].value

  • [Object] conditions

    • Object conditions[].dependency - Condition this flag value with another flag value

    • String conditions[].dependency.flag - Flag name

    • conditions[].dependency.value

    • Object conditions[].group - Condition flag value based on target group(s)

    • String conditions[].group.operator - The logical relationship between the groups

    • conditions[].group.name - Name of target groups

  • Object conditions[].version - Condition flag value based release version

    • String conditions[].version.operator - The operator to compare version

    • String conditions[].version.semver - The version to compare to

    • conditions[].value - Value when no Condition is met

Patch Experiment

Patch Experiment object by flag name, patching is done according to JSON-Patch (RFC6902)

Node cURL Ruby Python Java C# Go
var request = require("request");

var options = {
  method: 'PATCH',
  url: 'https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments/acmeFlagControl',
  headers: {
    'content-type': 'application/json',
    authorization: 'Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6'
  },
  body: [{op: 'add', path: 'devPath', value: 'baz', from: 'fooBar'}],
  json: true
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
curl --request PATCH \
  --url https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments/acmeFlagControl \
  --header 'authorization: Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6' \
  --header 'content-type: application/json' \
  --data '[{"op":"add","path":"devPath","value":"baz","from":"fooBar"}]'
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments/acmeFlagControl")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Patch.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6'
request.body = "[{\"op\":\"add\",\"path\":\"devPath\",\"value\":\"baz\",\"from\":\"fooBar\"}]"

response = http.request(request)
puts response.read_body
import requests

url = "https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments/acmeFlagControl"

payload = "[{\"op\":\"add\",\"path\":\"devPath\",\"value\":\"baz\",\"from\":\"fooBar\"}]"
headers = {
    'content-type': "application/json",
    'authorization': "Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6"
    }

response = requests.request("PATCH", url, data=payload, headers=headers)

print(response.text)
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "[{\"op\":\"add\",\"path\":\"devPath\",\"value\":\"baz\",\"from\":\"fooBar\"}]");
Request request = new Request.Builder()
  .url("https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments/acmeFlagControl")
  .patch(body)
  .addHeader("content-type", "application/json")
  .addHeader("authorization", "Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6")
  .build();

Response response = client.newCall(request).execute();
var client = new RestClient("https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments/acmeFlagControl");
var request = new RestRequest(Method.PATCH);
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6");
request.AddParameter("application/json", "[{\"op\":\"add\",\"path\":\"devPath\",\"value\":\"baz\",\"from\":\"fooBar\"}]", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments/acmeFlagControl"

	payload := strings.NewReader("[{\"op\":\"add\",\"path\":\"devPath\",\"value\":\"baz\",\"from\":\"fooBar\"}]")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("content-type", "application/json")
	req.Header.Add("authorization", "Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

PATH PARAMS

applicationId string The application id

environmentName* string - The name of the environment that the experiment belongs to

flagName* string - flag of the experiment

BODY PARAMS

  • op string - The operation to be performed (one of add, remove, replace, move, copy, test)

  • path string - Path to the value that is to be changed. Ex: path: value is like saying experiment.value

  • value string - The value to be used within the operations.

  • from string - A string containing a JSON Pointer value.

Delete Experiment

Removes experiment from the requested environment by its flag name

Node cURL Ruby Python Java C# Go
var request = require("request");

var options = {
  method: 'DELETE',
  url: 'https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments/acmeFlagControl',
  headers: {authorization: 'Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6'}
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
curl --request DELETE \
  --url https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments/acmeFlagControl \
  --header 'authorization: Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6'
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments/acmeFlagControl")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Delete.new(url)
request["authorization"] = 'Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6'

response = http.request(request)
puts response.read_body
import requests

url = "https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments/acmeFlagControl"

headers = {'authorization': 'Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6'}

response = requests.request("DELETE", url, headers=headers)

print(response.text)
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments/acmeFlagControl")
  .delete(null)
  .addHeader("authorization", "Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6")
  .build();

Response response = client.newCall(request).execute();
var client = new RestClient("https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments/acmeFlagControl");
var request = new RestRequest(Method.DELETE);
request.AddHeader("authorization", "Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6");
IRestResponse response = client.Execute(request);
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/Production/experiments/acmeFlagControl"

	req, _ := http.NewRequest("DELETE", url, nil)

	req.Header.Add("authorization", "Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

PATH PARAMS

  • applicationId* string - The application id

  • environmentName* string - The name of the environment that the experiment belongs to

  • flagName* string - flag of the experiment