Impressions

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 Environment Impressions for all flags

Get impressions for all flags within an environment

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/Production/impressions',
  qs: {
    mode: 'daily',
    from: '1595063738',
    to: '1597742139',
    platforms: 'aggregatedOnly'
  },
  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/Production/impressions?mode=daily&from=1595063738&to=1597742139&platforms=aggregatedOnly' \
  --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/Production/impressions?mode=daily&from=1595063738&to=1597742139&platforms=aggregatedOnly")

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/Production/impressions"

querystring = {"mode":"daily","from":"1595063738","to":"1597742139","platforms":"aggregatedOnly"}

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

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

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

Request request = new Request.Builder()
  .url("https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/environments/Production/impressions?mode=daily&from=1595063738&to=1597742139&platforms=aggregatedOnly")
  .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/Production/impressions?mode=daily&from=1595063738&to=1597742139&platforms=aggregatedOnly");
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/Production/impressions?mode=daily&from=1595063738&to=1597742139&platforms=aggregatedOnly"

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

QUERY PARAMS

  • mode string - Choose between daily and hourly report

  • from float - Start time (UTC) timestamp (in seconds) of the impressions. In hourly mode, value will be rounded down to the beginning of the hour. In daily mode, to the beginning of the day.

  • to float - End time (UTC) timestamp (in seconds) of the impressions. In hourly mode, value will be rounded up to the end of the hour and is limited to from + 24 hours. In daily mode, to the end of the day and limited to from + 31 days.

  • platforms string - Comma-separated list of platforms. Use 'all' for details of all platforms or 'aggregatedOnly' to see only the aggregated values (no details per platform)

Response

Flag values and counters per platform and time windows

Response schema type: array of objects

  • String flagName - Name of the flag

  • [Object] impressions - Impressions details for the flag

    • Number impressions[].from - Beginning of the time window, timestamp in seconds (UTC)

    • Number impressions[].to - End of the time window, timestamp in seconds (UTC)

  • [Object] impressions[].byPlatformValues - Details of flag values and counters, per platform

    • String impressions[].byPlatformValues[].platform - Name of the platform

    • [Object] impressions[].byPlatformValues[].values - Values and counters for each of them

  • [Object] impressions[].aggregatedValues - Details of flag values and counters

    • String impressions[].aggregatedValues[].value - Flag value

    • Number impressions[].aggregatedValues[].counter - Counter of flag impressions with that value

Get Environment Impressions for a single flag

Get impressions for one flag within an environment

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/AcmeEnvironment/impressions/default.addFlag',
  qs: {
    mode: 'daily',
    from: '1595063738',
    to: '1597742139',
    platforms: 'aggregatedOnly'
  },
  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/AcmeEnvironment/impressions/default.addFlag?mode=daily&from=1595063738&to=1597742139&platforms=aggregatedOnly' \
  --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/AcmeEnvironment/impressions/default.addFlag?mode=daily&from=1595063738&to=1597742139&platforms=aggregatedOnly")

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/AcmeEnvironment/impressions/default.addFlag"

querystring = {"mode":"daily","from":"1595063738","to":"1597742139","platforms":"aggregatedOnly"}

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

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

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

Request request = new Request.Builder()
  .url("https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/environments/AcmeEnvironment/impressions/default.addFlag?mode=daily&from=1595063738&to=1597742139&platforms=aggregatedOnly")
  .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/AcmeEnvironment/impressions/default.addFlag?mode=daily&from=1595063738&to=1597742139&platforms=aggregatedOnly");
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/AcmeEnvironment/impressions/default.addFlag?mode=daily&from=1595063738&to=1597742139&platforms=aggregatedOnly"

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

  • flagName string - Flag name

QUERY PARAMS

  • mode string - Choose between daily and hourly report

  • from float - Start time (UTC) timestamp (in seconds) of the impressions. In hourly mode, value will be rounded down to the beginning of the hour. In daily mode, to the beginning of the day.

  • to float - End time (UTC) timestamp (in seconds) of the impressions. In hourly mode, value will be rounded up to the end of the hour and is limited to from + 24 hours. In daily mode, to the end of the day and limited to from + 31 days.

  • platforms string - Comma-separated list of platforms. Use 'all' for details of all platforms or 'aggregatedOnly' to see only the aggregated values (no details per platform)

Response

Flag values and counters per platform and time windows

Response schema type: array of objects

  • String flagName - Name of the flag

  • [Object] impressions - Impressions details for the flag

    • Number impressions[].from - Beginning of the time window, timestamp in seconds (UTC)

    • Number impressions[].to - End of the time window, timestamp in seconds (UTC)

  • [Object] impressions[].byPlatformValues - Details of flag values and counters, per platform

    • String impressions[].byPlatformValues[].platform - Name of the platform

    • [Object] impressions[].byPlatformValues[].values - Values and counters for each of them

  • [Object] impressions[].aggregatedValues - Details of flag values and counters

    • String impressions[].aggregatedValues[].value - Flag value

    • Number impressions[].aggregatedValues[].counter - Counter of flag impressions with that value