Target Groups

6 minute readReference

Get Target Groups

This command gets Target Groups for an app.

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

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 [optional] The logical relationship between conditions 'or'|'and' ('or' if omitted)

  • [Object] conditions

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

    • String|Number|[String] conditions[].operand - [optional] The value to compare with the property and operator (second operand)

    • String conditions[].operator - The Operator of the condition (one of: 'in-array'|'is-undefined'|'is-true'| 'is-false'|'eq'|'ne'|'gte'|'gt'|'lt'|'lte'|'regex'| 'semver-ne'|'semver-eq'|'semver-gt'|'semver-gte'|'semver-lt'|'semver-lte')

Create Target Group

Add a new Target group or override an existing one.

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

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 - [optional] The logical relationship between conditions 'or'|'and' ('or' if omitted)

  • conditions [object] - Array of conditions

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

    • conditions[].operand string|number|[string] - [optional] The value to compare with the property and operator (second operand)

    • conditions[].operator string - The Operator of the condition (one of: 'in-array'|'is-undefined'|'is-true'| 'is-false'|'eq'|'ne'|'gte'|'gt'|'lt'|'lte'|'regex'| 'semver-ne'|'semver-eq'|'semver-gt'|'semver-gte'|'semver-lt'|'semver-lte')

Get Target Group

Get Target Group object by its name

https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/target-groups/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 [optional] The logical relationship between conditions 'or'|'and' ('or' if omitted)

  • [Object] conditions

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

    • String|Number|[String] conditions[].operand - [optional] The value to compare with the property and operator (second operand)

    • String conditions[].operator - The Operator of the condition (one of: 'in-array'|'is-undefined'|'is-true'| 'is-false'|'eq'|'ne'|'gte'|'gt'|'lt'|'lte'|'regex'| 'semver-ne'|'semver-eq'|'semver-gt'|'semver-gte'|'semver-lt'|'semver-lte')

Patch Target Group

Patch Target Group object by name, patching is done according to JSON-Patch (RFC6902)

https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/target-groups/name

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)

  • 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.

https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/target-groups/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

As a security measure, a rate limit has been implemented to one request per second, and is based on the requester IP address. Any requests at rates that exceed the rate limit will receive a 555 error status code. There are no exceptions we can currently make for customers at this time.