Target Groups

Experiments have been deprecated and Flags are the only entity in the system

  • The system is backwards compatible, but there are some critical issues to note until a new version of the Restful API is released:

    • Create an Experiment - creates a corresponding Flag, ignoring Experiment name.

    • Get Experiment - works as expected, ignoring Experiment name.

    • Patch Experiment - works as expected, ignoring Experiment name.

    • Get Experiments - returns only Flags that have at least one release rule configured.

    • Delete Experiment - removes a flag’s configuration and/or impression data, but does NOT delete the flag.

Get Target Groups

get Target Groups for app

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/target-groups',
  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/target-groups \
  --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/target-groups")

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/target-groups"

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/target-groups")
  .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/target-groups");
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/target-groups"

	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

Target groups response

Example:

[
  {
    "type": "target-group",
    "name": "tg",
    "description": "tg desc",
    "operator": "or",
    "conditions": [
      {
        "operator": "is-true",
        "property": "Foo"
      }
    ]
  }
]

Response schema type: array of objects

  • String - type type of the yaml object, have to be target-group

  • String - name The name of the target group

  • String - description The description of the target group

  • String - operator The logical relationship between conditions, 'or' if omitted

  • [Object] conditions

    • String conditions[].property - The Custom property to be conditioned (first operand)

    • String conditions[].operator - The Operator of the condition

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

Create Target Group

Add a new Target group 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/target-groups',
  headers: {
    'content-type': 'application/json',
    authorization: 'Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6'
  },
  body: {
    conditions: [{operator: 'is-true', property: 'Foo', operand: 'run'}],
    apiVersion: '1.0',
    type: 'target-group',
    name: 'tg',
    description: 'tg desc',
    operator: 'or',
    value: '0'
  },
  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/target-groups \
  --header 'authorization: Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6' \
  --header 'content-type: application/json' \
  --data '{"conditions":[{"operator":"is-true","property":"Foo","operand":"run"}],"apiVersion":"1.0","type":"target-group","name":"tg","description":"tg desc","operator":"or","value":"0"}'
require 'uri'
require 'net/http'
require 'openssl'

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

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 = "{\"conditions\":[{\"operator\":\"is-true\",\"property\":\"Foo\",\"operand\":\"run\"}],\"apiVersion\":\"1.0\",\"type\":\"target-group\",\"name\":\"tg\",\"description\":\"tg desc\",\"operator\":\"or\",\"value\":\"0\"}"

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

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

payload = "{\"conditions\":[{\"operator\":\"is-true\",\"property\":\"Foo\",\"operand\":\"run\"}],\"apiVersion\":\"1.0\",\"type\":\"target-group\",\"name\":\"tg\",\"description\":\"tg desc\",\"operator\":\"or\",\"value\":\"0\"}"
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, "{\"conditions\":[{\"operator\":\"is-true\",\"property\":\"Foo\",\"operand\":\"run\"}],\"apiVersion\":\"1.0\",\"type\":\"target-group\",\"name\":\"tg\",\"description\":\"tg desc\",\"operator\":\"or\",\"value\":\"0\"}");
Request request = new Request.Builder()
  .url("https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/target-groups")
  .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/target-groups");
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", "{\"conditions\":[{\"operator\":\"is-true\",\"property\":\"Foo\",\"operand\":\"run\"}],\"apiVersion\":\"1.0\",\"type\":\"target-group\",\"name\":\"tg\",\"description\":\"tg desc\",\"operator\":\"or\",\"value\":\"0\"}", 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/target-groups"

	payload := strings.NewReader("{\"conditions\":[{\"operator\":\"is-true\",\"property\":\"Foo\",\"operand\":\"run\"}],\"apiVersion\":\"1.0\",\"type\":\"target-group\",\"name\":\"tg\",\"description\":\"tg desc\",\"operator\":\"or\",\"value\":\"0\"}")

	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

BODY PARAMS

  • apiVersion string - Yaml api version

  • type string - type of the yaml object, have to be target-group

  • name string - The name of the target group

  • description string - The description of the target group

  • operator string - The logical relationship between conditions, 'or' if omitted

  • conditions - array of objects

    • property string - The Custom property to be conditioned (first operand)

    • operator string - The Operator of the condition

    • operand string - Option (1-3)

  • value string, boolean, float, array - Value when no Condition is met

Get Target Group

get Target Group object by its 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/target-groups/fooGroup',
  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/target-groups/fooGroup \
  --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/target-groups/fooGroup")

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/target-groups/fooGroup"

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/target-groups/fooGroup")
  .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/target-groups/fooGroup");
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/target-groups/fooGroup"

	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

  • name* string - name of the target group

Target groups response

Example:

{
  "type": "target-group",
  "name": "tg",
  "description": "tg desc",
  "operator": "or",
  "conditions": [
    {
      "operator": "is-true",
      "property": "Foo"
    }
  ]
}

Response schema type: object

  • String type - type of the yaml object, have to be target-group

  • String name - The name of the target group

  • String description - The description of the target group

  • String operator - The logical relationship between conditions, 'or' if omitted

  • [Object] conditions

    • String conditions[].property - The Custom property to be conditioned (first operand)

    • String conditions[].operator - The Operator of the confition

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

Patch Target Group

patch Target Group object by 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/target-groups/fooGroup',
  headers: {
    'content-type': 'application/json',
    authorization: 'Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6'
  },
  body: [{op: 'add', path: 'acmePath', 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/target-groups/fooGroup \
  --header 'authorization: Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6' \
  --header 'content-type: application/json' \
  --data '[{"op":"add","path":"acmePath","value":"baz","from":"fooBar"}]'
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/target-groups/fooGroup")

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\":\"acmePath\",\"value\":\"baz\",\"from\":\"fooBar\"}]"

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

url = "https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/target-groups/fooGroup"

payload = "[{\"op\":\"add\",\"path\":\"acmePath\",\"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\":\"acmePath\",\"value\":\"baz\",\"from\":\"fooBar\"}]");
Request request = new Request.Builder()
  .url("https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/target-groups/fooGroup")
  .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/target-groups/fooGroup");
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\":\"acmePath\",\"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/target-groups/fooGroup"

	payload := strings.NewReader("[{\"op\":\"add\",\"path\":\"acmePath\",\"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

  • name* string - name of the target group

BODY PARAMS

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

  • add path string - Path to the value that is to be changed. Ex: path: description is like saying target group.description

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

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

Delete Target Group

delete Target Group by its 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/target-groups/fooGroup',
  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/target-groups/fooGroup \
  --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/target-groups/fooGroup")

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/target-groups/fooGroup"

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/target-groups/fooGroup")
  .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/target-groups/fooGroup");
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/target-groups/fooGroup"

	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

  • name* string - name of the target group