Environments

Get Environments

Returns all environments under specific application

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

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/environments"

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

	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

Environment Response

Example:

[
  0:{
    "name":"Production"
    "key":"1a23bcd4e5fg6h7890i123j4"
    "description":"Production Environment (default)"
  }
]

Response schema type: array of objects

  • String name - Name of environment

  • String key - The environment key to be used when initializing the SDK

  • String description - Description of the environment

Create Environment

Add a new Environment 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/environments',
  headers: {
    'content-type': 'application/json',
    authorization: 'Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6'
  },
  body: {name: 'AcmeEnvironment', description: 'Acme Corp development environment'},
  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/environments \
  --header 'authorization: Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6' \
  --header 'content-type: application/json' \
  --data '{"name":"AcmeEnvironment","description":"Acme Corp development environment"}'
require 'uri'
require 'net/http'
require 'openssl'

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

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 = "{\"name\":\"AcmeEnvironment\",\"description\":\"Acme Corp development environment\"}"

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

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

payload = "{\"name\":\"AcmeEnvironment\",\"description\":\"Acme Corp development environment\"}"
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, "{\"name\":\"AcmeEnvironment\",\"description\":\"Acme Corp development environment\"}");
Request request = new Request.Builder()
  .url("https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/environments")
  .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/environments");
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", "{\"name\":\"AcmeEnvironment\",\"description\":\"Acme Corp development environment\"}", 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/environments"

	payload := strings.NewReader("{\"name\":\"AcmeEnvironment\",\"description\":\"Acme Corp development environment\"}")

	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

  • name* string - Name of environment

  • description string - Description of environment

Patch Environment

Patch an environment

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/environments/AcmeEnvironment',
  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/environments/AcmeEnvironment \
  --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/environments/AcmeEnvironment")

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/environments/AcmeEnvironment"

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/environments/AcmeEnvironment")
  .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/environments/AcmeEnvironment");
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/environments/AcmeEnvironment"

	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 environment name

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.

foobar

Delete Environment

Delete an environment

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/environments/AcmeEnvironment',
  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/environments/AcmeEnvironment \
  --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/environments/AcmeEnvironment")

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/environments/AcmeEnvironment"

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/environments/AcmeEnvironment")
  .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/environments/AcmeEnvironment");
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/environments/AcmeEnvironment"

	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 environment name