import SimpleFlags from 'simpleflags-io';
const isEnabled = await SimpleFlags.isEnabled({
teamId: 'TEAM_ID',
environmentKey: 'ENV_KEY',
flagKey: 'FLAG_KEY',
groupingKey: 'GROUP_KEY'
});
if (isEnabled) { ... }
String urlString = String.format("https://simpleflags.io/api/flag/%s/%s/%s/%s",
"TEAM_ID", "FLAG_KEY", "ENV_KEY", "GROUP_KEY");
URL url = new URL(urlString);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
StringBuilder response = new StringBuilder();
String inputLine;
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
boolean isEnabled = response.toString().contains(""status":"enabled"");
if (isEnabled) {
// Do something if the feature flag is enabled
}
# Apply in your preferred language
curl https://simpleflags.io/api/flag/{teamId}/{flagKey}/{environmentKey}/{groupingKey}
# {"status":"disabled"}
<?php
$teamId = "TEAM_ID";
$environmentKey = "ENV_KEY";
$flagKey = "FLAG_KEY";
$groupingKey = "GROUP_KEY";
$url = "https://simpleflags.io/api/flag/$teamId/$flagKey/$environmentKey/$groupingKey";
$response = file_get_contents($url);
$isEnabled = strpos($response, '"status":"enabled"') !== false;
if ($isEnabled) {
// Do something if the feature flag is enabled
}
?>
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse("https://simpleflags.io/api/flag/TEAM_ID/FLAG_KEY/ENV_KEY/GROUP_KEY")
response = Net::HTTP.get_response(uri)
isEnabled = JSON.parse(response.body)["status"] == "enabled"
if isEnabled
# Do something if the feature flag is enabled
end
import requests
url = "https://simpleflags.io/api/flag/TEAM_ID/FLAG_KEY/ENV_KEY/GROUP_KEY"
response = requests.get(url)
data = response.json()
isEnabled = data["status"] == "enabled"
if isEnabled:
# Do something if the feature flag is enabled
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
class Program
{
static async Task Main(string[] args)
{
string url = "https://simpleflags.io/api/flag/TEAM_ID/FLAG_KEY/ENV_KEY/GROUP_KEY";
using HttpClient client = new HttpClient();
HttpResponseMessage response = await client.GetAsync(url);
string responseBody = await response.Content.ReadAsStringAsync();
JObject json = JObject.Parse(responseBody);
bool isEnabled = (string)json["status"] == "enabled";
if (isEnabled)
{
// Do something if the feature flag is enabled
}
}
}
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://simpleflags.io/api/flag/TEAM_ID/FLAG_KEY/ENV_KEY/GROUP_KEY"
response, err := http.Get(url)
if err != nil {
panic(err)
}
defer response.Body.Close()
body, err := ioutil.ReadAll(response.Body)
if err != nil {
panic(err)
}
var result map[string]interface{}
json.Unmarshal(body, &result)
isEnabled := result["status"] == "enabled"
if isEnabled {
// Do something if the feature flag is enabled
}
}