### Get Product using HttpClient in C# Source: https://configcat.com/docs/api/reference/get-product This C# example demonstrates how to make a GET request to the products endpoint using `HttpClient`. It includes setting the `Accept` and `Authorization` headers. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://api.configcat.com/v1/products/:productId"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Basic PHVzZXJuYW1lPjo8cGFzc3dvcmQ+"); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Install ConfigCat Go SDK Source: https://configcat.com/docs/sdk-reference/go Use the `go get` command to download and install the latest version of the ConfigCat Go SDK. ```bash go get github.com/configcat/go-sdk/v9 ``` -------------------------------- ### Get ConfigCat Go SDK Source: https://configcat.com/docs/sdk-reference/go Install the ConfigCat Go SDK using the go get command. ```bash go get github.com/configcat/go-sdk/v9 ``` -------------------------------- ### C# HttpClient Example for Listing Configs Source: https://configcat.com/docs/api/reference/get-configs This C# example demonstrates how to use `HttpClient` to make a GET request to the List Configs endpoint. It includes setting the `Accept` and `Authorization` headers. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://api.configcat.com/v1/products/:productId/configs"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Basic PHVzZXJuYW1lPjo8cGFzc3dvcmQ+"); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Get Proxy Profile SDK Keys Example Source: https://configcat.com/docs/api/reference/get-proxy-profile-sdk-keys This example demonstrates how to retrieve SDK keys for a given Proxy Profile ID. Ensure you replace `:proxyProfileId` with the actual ID. The `Authorization` header must be set with your basic authentication credentials. ```http GET ## https://api.configcat.com/v1/proxy-profiles/:proxyProfileId/sdk-keys ``` ```json { "items": [ { "primarySdkKey": "string", "secondarySdkKey": "string", "sdkId": "string", "configId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "environmentId": "3fa85f64-5717-4562-b3fc-2c963f66afa6" } ] } ``` -------------------------------- ### Execute ConfigCat CLI command Source: https://configcat.com/docs/advanced/cli Example of running a ConfigCat CLI command after installation. ```bash configcat scan "/repository" --print --config-id ``` -------------------------------- ### Get Product Preferences Example (C#) Source: https://configcat.com/docs/api/reference/get-product-preferences Demonstrates how to retrieve product preferences using HttpClient in C#. Ensure to replace placeholder values with your actual credentials and productId. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://api.configcat.com/v1/products/:productId/preferences"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Basic PHVzZXJuYW1lPjo8cGFzc3dvcmQ+"); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### List Product Integrations using HttpClient Source: https://configcat.com/docs/api/reference/get-integrations This C# example demonstrates how to make a GET request to the integrations endpoint using `HttpClient`. Ensure you replace `:productId` with the actual product ID and `PHVzZXJuYW1lPjo8cGFzc3dvcmQ+` with your base64 encoded credentials. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://api.configcat.com/v1/products/:productId/integrations"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Basic PHVzZXJuYW1lPjo8cGFzc3dvcmQ+"); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Install and Use ConfigCat CLI in GitHub Actions Source: https://configcat.com/docs/integrations/github-cli This example demonstrates how to set up a GitHub Actions workflow to install and utilize the ConfigCat CLI. Ensure your repository's GitHub Secrets are configured with `CONFIGCAT_API_USER` and `CONFIGCAT_API_PASS` for authentication. ```yaml name: Workflow with ConfigCat CLI on: push jobs: example-job: runs-on: ubuntu-latest env: CONFIGCAT_API_USER: ${{ secrets.CONFIGCAT_API_USER }} CONFIGCAT_API_PASS: ${{ secrets.CONFIGCAT_API_PASS }} steps: - uses: configcat/cli-actions@v1 # Using the CLI in other steps - name: Update feature flag value run: configcat flag-v2 value update --flag-id --environment-id --flag-value true ``` -------------------------------- ### C# HttpClient Example Source: https://configcat.com/docs/api/reference/get-proxy-profile-sdk-keys This C# code snippet shows how to make a GET request to the API to fetch SDK keys for a proxy profile. It includes setting the necessary headers for `Accept` and `Authorization`. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://api.configcat.com/v1/proxy-profiles/:proxyProfileId/sdk-keys"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Basic PHVzZXJuYW1lPjo8cGFzc3dvcmQ+"); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Retrieve Environment using HttpClient in C# Source: https://configcat.com/docs/api/reference/get-environment This C# example demonstrates how to use `HttpClient` to make a GET request to the environments endpoint. It includes setting the request URL, `Accept` header, and `Authorization` header. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://api.configcat.com/v1/environments/:environmentId"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Basic PHVzZXJuYW1lPjo8cGFzc3dvcmQ+ "); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Install ConfigCat OpenFeature Provider for Go Source: https://configcat.com/docs/sdk-reference/openfeature/go Use this command to install the provider. Ensure you have Go installed and configured. ```go go get github.com/open-feature/go-sdk-contrib/providers/configcat ``` -------------------------------- ### Connect Application with ConfigCat SDK Source: https://configcat.com/docs/getting-started This snippet demonstrates how to connect your application to the ConfigCat service using the SDK. It shows how to install the SDK, get a client object with your SDK Key, and evaluate a feature flag to conditionally enable features. ```javascript // 0. If necessary, install the ConfigCat SDK package for the platform you use. // E.g. `npm install @configcat/sdk` // 1. Import the ConfigCat SDK package. import * as configcat from '@configcat/sdk'; // 2. Get a client object for the SDK Key of your config. const client = configcat.getClient('#YOUR-SDK-KEY#'); // 3. Evaluate a feature flag using the client object. const value = await client.getValueAsync('isMyFeatureEnabled', false); // 4. Based on the value of the feature flag decide whether or not to enable the related feature. if (value) { do_the_new_thing(); } else { do_the_old_thing(); } ``` -------------------------------- ### Install ConfigCat CLI using install script (Unix) Source: https://configcat.com/docs/advanced/cli Install the ConfigCat CLI on Unix-like systems using a curl-based install script. ```bash curl -fsSL "https://raw.githubusercontent.com/configcat/cli/main/scripts/install.sh" | bash ``` -------------------------------- ### Install ConfigCat SDK with Vcpkg on Windows Source: https://configcat.com/docs/sdk-reference/cpp Use Vcpkg to install the ConfigCat SDK on Windows. After installation, the SDK can be included and used directly in your project. ```cmd git clone https://github.com/microsoft/vcpkg .\vcpkg\bootstrap-vcpkg.bat .\vcpkg\vcpkg install configcat ``` ```cmd .\vcpkg\vcpkg integrate install ``` -------------------------------- ### List Products Example (C#) Source: https://configcat.com/docs/api/reference/get-products Demonstrates how to fetch the list of products using HttpClient in C#. Ensure you have the correct authorization header. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://api.configcat.com/v1/products"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Basic PHVzZXJuYW1lPjo8cGFzc3dvcmQ+"); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### C# HttpClient Example Source: https://configcat.com/docs/api/scim/get-resource-type Example of how to make a GET request to retrieve a resource type using HttpClient in C#. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://scim-api.configcat.com/v2/:organizationId/ResourceTypes/:resourceTypeId"); request.Headers.Add("Accept", "application/scim+json"); request.Headers.Add("Authorization", "Bearer "); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Initialize ConfigCat Client with Setup Hooks Source: https://configcat.com/docs/sdk-reference/js/browser Demonstrates how to initialize the ConfigCat client and subscribe to the 'clientReady' hook to log the number of available feature flags upon readiness. Requires the SDK key and polling mode. ```javascript const configCatClient = configcat.getClient( '#YOUR-SDK-KEY#', configcat.PollingMode.AutoPoll, { setupHooks: (hooks) => hooks.on('clientReady', function() { const keys = this.configCatClient.snapshot().getAllKeys(); console.log(`Client is ready! Number of available feature flags: ${keys.length}`); }), }, ); ``` -------------------------------- ### Initialize ConfigCat Client with Event Subscription Source: https://configcat.com/docs/sdk-reference/dotnet Demonstrates how to get a ConfigCat client instance and subscribe to the 'ClientReady' event to log the number of available feature flags upon initialization. This approach is useful for performing actions once the client has successfully fetched configurations. ```csharp IConfigCatClient client = ConfigCatClient.Get("#YOUR-SDK-KEY#", options => { options.ClientReady += (s, e) => { var keys = ((IConfigCatClient)s).Snapshot().GetAllKeys(); Console.WriteLine("Client is ready! Number of available feature flags: " + keys.Count); }; }); ``` -------------------------------- ### Get Setting Value Source: https://configcat.com/docs/api/reference/get-setting-value-by-sdkkey This example demonstrates how to retrieve a setting's value using its SDK key via an HTTP GET request. ```APIDOC ## GET /v1/settings/:settingKeyOrId/value ### Description Retrieves the value of a specific setting using its SDK key. ### Method GET ### Endpoint https://api.configcat.com/v1/settings/:settingKeyOrId/value ### Parameters #### Path Parameters - **settingKeyOrId** (string) - Required - The SDK key or ID of the setting to retrieve. #### Headers - **Authorization** (string) - Required - Basic authentication header with your API credentials. - **X-CONFIGCAT-SDKKEY** (string) - Required - Your ConfigCat SDK Key. ### Response #### Success Response (200) - **value** (string) - The current value of the setting. - **lastUpdate** (string) - The timestamp when the setting was last updated. - **settingId** (string) - The ID of the setting. - **settingKey** (string) - The SDK key of the setting. - **settingType** (string) - The type of the setting (e.g., 'String', 'Int', 'Boolean'). - **isA/bTestingEnabled** (boolean) - Indicates if A/B testing is enabled for this setting. - **isAnalyzed** (boolean) - Indicates if the setting is analyzed. ### Request Example ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://api.configcat.com/v1/settings/:settingKeyOrId/value"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Basic PHVzZXJuYW1lPjo8cGFzc3dvcmQ+"); request.Headers.Add("X-CONFIGCAT-SDKKEY", "YOUR_SDK_KEY"); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` ``` -------------------------------- ### Create Environment C# Example Source: https://configcat.com/docs/api/reference/create-environment This C# example demonstrates how to create a new environment using HttpClient. Ensure you include the correct authorization header and JSON payload. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Post, "https://api.configcat.com/v1/products/:productId/environments"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Basic PHVzZXJuYW1lPjo8cGFzc3dvcmQ+"); var content = new StringContent("{\n \"name\": \"string\",\n \"color\": \"string\",\n \"description\": \"string\",\n \"order\": 0\n}", null, "application/json"); request.Content = content; var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### C# HttpClient Example Source: https://configcat.com/docs/api/scim/get-user Example of how to make a GET request to the SCIM API using C# HttpClient. Ensure you replace with your actual SCIM token. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://scim-api.configcat.com/v2/:organizationId/Users/:userId"); request.Headers.Add("Accept", "application/scim+json"); request.Headers.Add("Authorization", "Bearer "); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Create ConfigCat Client Source: https://configcat.com/docs/sdk-reference/go Create a ConfigCat client instance using your SDK Key. Replace '#YOUR-SDK-KEY#' with your actual SDK Key obtained from the ConfigCat Dashboard. ```go client := configcat.NewClient("#YOUR-SDK-KEY#") ``` -------------------------------- ### HTTP GET Request Example (C#) Source: https://configcat.com/docs/api/scim/get-group Example of how to retrieve a group using HttpClient in C#. Ensure you replace the placeholder token with your actual SCIM token. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://scim-api.configcat.com/v2/:organizationId/Groups/:groupId"); request.Headers.Add("Accept", "application/scim+json"); request.Headers.Add("Authorization", "Bearer "); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### C# HttpClient Example Source: https://configcat.com/docs/api/reference/get-environments Demonstrates how to use HttpClient in C# to call the List Environments endpoint. Ensure to replace placeholder credentials and productId. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://api.configcat.com/v1/products/:productId/environments"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Basic PHVzZXJuYW1lPjo8cGFzc3dvcmQ+"); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Get Proxy Profile Example Source: https://configcat.com/docs/api/reference/get-proxy-profile This example demonstrates how to retrieve a Proxy Profile using its ID. Ensure you replace ':proxyProfileId' with the actual ID of the profile you want to fetch. ```http GET ## https://api.configcat.com/v1/proxy-profiles/:proxyProfileId ``` ```json { "proxyProfileId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "name": "string", "description": "string", "lastAccessedAt": "2024-07-29T15:51:28.071Z", "connectionPreferences": { "sdkPollInterval": 0, "webhookNotification": { "webhookProxyUrl": "string", "signingKey1": "string", "signingKey2": "string" } }, "sdkKeySelectionRules": [ { "kind": "include", "productIdFilter": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "configIdFilter": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "environmentIdFilter": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "productNameMatchFilter": "string", "configNameMatchFilter": "string", "environmentNameMatchFilter": "string" } ] } ``` -------------------------------- ### Get Staleflags using HttpClient in C# Source: https://configcat.com/docs/api/reference/get-staleflags This C# example demonstrates how to make a GET request to the staleflags endpoint using `HttpClient`. Ensure the `Authorization` header is correctly set. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://api.configcat.com/v1/products/:productId/staleflags"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Basic PHVzZXJuYW1lPjo8cGFzc3dvcmQ+"); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Create Product using HttpClient in C# Source: https://configcat.com/docs/api/reference/create-product This C# example demonstrates how to use HttpClient to send a POST request to create a product. It includes setting the endpoint, headers for accept and authorization, and the JSON request body. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Post, "https://api.configcat.com/v1/organizations/:organizationId/products"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Basic PHVzZXJuYW1lPjo8cGFzc3dvcmQ+"); var content = new StringContent("{\n \"name\": \"string\",\n \"description\": \"string\",\n \"order\": 0\n}", null, "application/json"); request.Content = content; var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Create ConfigCat Client with SDK Key Source: https://configcat.com/docs/sdk-reference/dotnet Instantiate the ConfigCat client using your SDK key. Replace '#YOUR-SDK-KEY#' with your actual key. ```csharp var client = ConfigCatClient.Get("#YOUR-SDK-KEY#"); ``` -------------------------------- ### Get Setting Value Source: https://configcat.com/docs/api/reference/get-setting-value-v-2 This example demonstrates how to retrieve the value of a setting using C# and HttpClient. ```APIDOC ## GET /v2/environments/:environmentId/settings/:settingId/value ### Description Retrieves the value of a specific setting for a given environment. ### Method GET ### Endpoint https://api.configcat.com/v2/environments/:environmentId/settings/:settingId/value ### Parameters #### Path Parameters - **environmentId** (string) - Required - The ID of the environment. - **settingId** (string) - Required - The ID of the setting. ### Request Example ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://api.configcat.com/v2/environments/:environmentId/settings/:settingId/value"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Basic PHVzZXJuYW1lPjo8cGFzc3dvcmQ+"); // Replace with your actual credentials var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` ### Response #### Success Response (200) - **value** (string) - The current value of the setting. - **lastUpdate** (string) - The timestamp of the last update. #### Response Example ```json { "value": "example_setting_value", "lastUpdate": "2023-10-27T10:00:00Z" } ``` ``` -------------------------------- ### Create ConfigCat Client Source: https://configcat.com/docs/sdk-reference/cpp Instantiate the ConfigCat client using your SDK key. Replace "#YOUR-SDK-KEY#" with your actual SDK key. ```cpp auto client = ConfigCatClient::get("#YOUR-SDK-KEY#"); ``` -------------------------------- ### Get Setting Values Source: https://configcat.com/docs/api/reference/get-setting-values This example demonstrates how to retrieve setting values using HttpClient in C#. ```APIDOC ## GET /v1/configs/:configId/environments/:environmentId/values ### Description Retrieves the values of settings for a specific configuration and environment. ### Method GET ### Endpoint https://api.configcat.com/v1/configs/:configId/environments/:environmentId/values ### Parameters #### Path Parameters - **configId** (string) - Required - The ID of the configuration. - **environmentId** (string) - Required - The ID of the environment. ### Request Example ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://api.configcat.com/v1/configs/:configId/environments/:environmentId/values"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Basic PHVzZXJuYW1lPjo8cGFzc3dvcmQ+"); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` ### Response #### Success Response (200) - **field1** (type) - Description #### Response Example { "example": "response body" } ``` -------------------------------- ### Get Permission Groups Source: https://configcat.com/docs/api/reference/get-permission-groups This example demonstrates how to retrieve permission groups using C# and HttpClient. ```APIDOC ## GET /v1/products/:productId/permissions ### Description Retrieves a list of permission groups for a given product. ### Method GET ### Endpoint https://api.configcat.com/v1/products/:productId/permissions ### Parameters #### Path Parameters - **productId** (string) - Required - The ID of the product to retrieve permission groups for. ### Request Example ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://api.configcat.com/v1/products/{productId}/permissions"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Basic "); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` ### Response #### Success Response (200) - **permissions** (array) - A list of permission group objects. - **id** (string) - The unique identifier of the permission group. - **name** (string) - The name of the permission group. - **description** (string) - A description of the permission group. - **order** (integer) - The order in which the permission group is displayed. - **groupId** (string) - The identifier of the group the permission belongs to. - **isDefault** (boolean) - Indicates if this is the default permission group. - **isProductAdmin** (boolean) - Indicates if this permission group has product administrator privileges. - **isOwner** (boolean) - Indicates if this permission group is owned by the product creator. #### Response Example ```json { "permissions": [ { "id": "123e4567-e89b-12d3-a456-426614174000", "name": "Viewer", "description": "Can view product settings and configurations.", "order": 1, "groupId": "group-viewer", "isDefault": true, "isProductAdmin": false, "isOwner": false } ] } ``` ``` -------------------------------- ### Install and Import Package Source: https://configcat.com/docs/sdk-reference/js/bun Install the ConfigCat SDK using npm and import the necessary module for Bun.js. ```APIDOC ## Install ```bash npm i @configcat/sdk ``` ## Import ```js import * as configcat from "@configcat/sdk/bun"; ``` ``` -------------------------------- ### Get Groups Source: https://configcat.com/docs/api/scim/get-groups This example demonstrates how to retrieve a list of groups using the SCIM API with C# HttpClient. ```APIDOC ## GET /v2/:organizationId/Groups ### Description Retrieves a list of groups associated with the specified organization. ### Method GET ### Endpoint https://scim-api.configcat.com/v2/:organizationId/Groups ### Parameters #### Path Parameters - **organizationId** (string) - Required - The ID of the organization. #### Query Parameters - **filter** (string) - Optional - Filters the results based on specified criteria. - **startIndex** (integer) - Optional - The starting index for pagination. - **count** (integer) - Optional - The number of results to return per page. - **attributes** (string) - Optional - Specifies which attributes to include in the response. - **excludedAttributes** (string) - Optional - Specifies which attributes to exclude from the response. ### Request Example ```http GET https://scim-api.configcat.com/v2/YOUR_ORGANIZATION_ID/Groups?startIndex=1&count=10 Authorization: Bearer YOUR_SCIM_TOKEN Accept: application/scim+json ``` ### Response #### Success Response (200) - **schemas** (array) - The list of schemas used in the response. - **totalResults** (integer) - The total number of groups available. - **itemsPerPage** (integer) - The number of groups returned per page. - **startIndex** (integer) - The starting index of the returned groups. - **Resources** (array) - An array of group objects. - **id** (string) - The unique identifier for the group. - **displayName** (string) - The name of the group. - **members** (array) - A list of members in the group. - **meta** (object) - Metadata about the group. #### Response Example ```json { "schemas": ["urn:ietf:params:scim:api:messages:2.0:ListResponse"], "totalResults": 1, "itemsPerPage": 10, "startIndex": 1, "Resources": [ { "id": "123e4567-e89b-12d3-a456-426614174000", "displayName": "Example Group", "members": [ { "value": "123e4567-e89b-12d3-a456-426614174001", "$ref": "/Users/123e4567-e89b-12d3-a456-426614174001", "display": "John Doe" } ], "meta": { "resourceType": "Group", "created": "2023-01-01T12:00:00Z", "lastModified": "2023-01-01T12:00:00Z", "location": "https://scim-api.configcat.com/v2/YOUR_ORGANIZATION_ID/Groups/123e4567-e89b-12d3-a456-426614174000" } } ] } ``` ``` -------------------------------- ### Get Users using HttpClient in C# Source: https://configcat.com/docs/api/scim/get-users This C# example demonstrates how to make a GET request to the SCIM API to retrieve users. Ensure you replace `` with your actual SCIM token and `:organizationId` with your organization's ID. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://scim-api.configcat.com/v2/:organizationId/Users"); request.Headers.Add("Accept", "application/scim+json"); request.Headers.Add("Authorization", "Bearer "); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Example Config Setting Resource Source: https://configcat.com/docs/api/reference/post-setting-values-v-2 This is an example of a Feature Flag resource with default values and targeting rules. ```json { "settingFormulas": [ { "defaultValue": { "boolValue": false }, "targetingRules": [ { "conditions": [ { "userCondition": { "comparisonAttribute": "Email", "comparator": "sensitiveTextEquals", "comparisonValue": { "stringValue": "test@example.com" } } } ], "percentageOptions": [], "value": { "boolValue": true } } ], "settingId": 1 } ] } ``` -------------------------------- ### Installation and Import Source: https://configcat.com/docs/sdk-reference/js/chromium-extension Instructions for installing the ConfigCat SDK via NPM and importing the necessary module for Chromium extensions. Also includes CDN import method. ```APIDOC ## Installation ### Via NPM ```bash npm i @configcat/sdk ``` ### Via CDN ```html ``` ## Import ### TypeScript/ES Modules ```js import * as configcat from "@configcat/sdk/chromium-extension"; ``` **Note:** For subpath imports to work in TypeScript, set `moduleResolution` to `node16`, `nodenext`, or `bundler` in `tsconfig.json`. For older TypeScript versions, use `node` resolution and import from the main entry point `@configcat/sdk`. ``` -------------------------------- ### Scan and Upload with Git VCS (Minimal) Source: https://configcat.com/docs/advanced/code-references/manual Use the `scan` command with the `--upload` option for Git repositories. This example includes only the required parameters for a minimal setup. ```bash configcat scan /path/to/your/repo \ --config-id YOUR-CONFIG-ID \ --repo YOUR-REPOSITORY-NAME \ --upload ``` -------------------------------- ### Evaluate a Boolean Feature Flag Source: https://configcat.com/docs/sdk-reference/openfeature/node Evaluate a boolean feature flag using the OpenFeature client. This example shows how to get the value of 'isAwesomeFeatureEnabled' and conditionally execute code. ```typescript const isAwesomeFeatureEnabled = await client.getBooleanValue('isAwesomeFeatureEnabled', false); if (isAwesomeFeatureEnabled) { doTheNewThing(); } else { doTheOldThing(); } ``` -------------------------------- ### Create ConfigCat Client Source: https://configcat.com/docs/sdk-reference/python Initialize the ConfigCat client with your unique SDK Key. Replace '#YOUR-SDK-KEY#' with your actual key from the ConfigCat dashboard. ```python client = configcatclient.get('#YOUR-SDK-KEY#') ``` -------------------------------- ### Creating the ConfigCat Client Source: https://configcat.com/docs/sdk-reference/ruby This snippet demonstrates how to create a ConfigCat client instance using a provided SDK key and configuring it with specific options, such as auto-polling. It's recommended to use the client as a singleton. ```APIDOC ## Creating the ConfigCat Client This method creates a singleton client instance for your SDK key. It is strongly recommended to use the ConfigCat Client as a Singleton object in your application. ### Method Signature ```ruby ConfigCat.get(sdk_key, options = nil) ``` ### Parameters - **sdk_key** (string) - Required - Your ConfigCat SDK key. - **options** (ConfigCatOptions) - Optional - Configuration options for the client. ### Options - `default_user`: Sets the default user. [More about default user](#default-user). - `hooks`: Used to subscribe to events that the SDK sends in specific scenarios. [More about hooks](#hooks). - `offline`: Indicates whether the SDK should be initialized in offline mode. Defaults to `false`. [More about offline mode](#online--offline-mode). ### Request Example ```ruby client = ConfigCat.get('#YOUR-SDK-KEY#', ConfigCat::ConfigCatOptions.new( polling_mode: ConfigCat::PollingMode.auto_poll ) ) ``` ### Closing the Client Clients can be closed individually with `client.close` or all at once with `ConfigCat.close_all`. ``` -------------------------------- ### Initialize the Provider Source: https://configcat.com/docs/sdk-reference/openfeature/dotnet Demonstrates how to initialize the ConfigCat provider with optional SDK configurations and create an OpenFeature client. ```APIDOC ## Initialize the provider The `ConfigCatProvider` constructor takes the SDK key and an optional callback that can be used to specify additional configuration options for the ConfigCat .NET SDK: ```csharp using System; using ConfigCat.Client; using OpenFeature.Contrib.ConfigCat; // Specify options for the ConfigCat SDK. Action configureOptions = (options) => { options.PollingMode = PollingModes.AutoPoll(pollInterval: TimeSpan.FromSeconds(60)); options.Logger = new ConsoleLogger(LogLevel.Warning); // ... }; // Configure the provider. await OpenFeature.Api.Instance.SetProviderAsync(new ConfigCatProvider("#YOUR-SDK-KEY#", configureOptions)); // Create a client. var client = OpenFeature.Api.Instance.GetClient(); ``` For more information about all the configuration options, see the .NET SDK documentation. ``` -------------------------------- ### Get Schema Example (C#) Source: https://configcat.com/docs/api/scim/get-schema Demonstrates how to retrieve a schema using HttpClient in C#. Ensure you replace placeholders with your actual organization ID, schema ID, and SCIM token. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://scim-api.configcat.com/v2/:organizationId/Schemas/:schemaId"); request.Headers.Add("Accept", "application/scim+json"); request.Headers.Add("Authorization", "Bearer "); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Create ConfigCat Client with SDK Key Source: https://configcat.com/docs/sdk-reference/js/cloudflare-worker Use this to get a ConfigCat client instance with default options. Replace `` with your actual SDK key obtained from the ConfigCat Dashboard. ```javascript const configcatClient = configcat.getClient(''); ``` -------------------------------- ### Get Webhook Signing Keys Example (C#) Source: https://configcat.com/docs/api/reference/get-webhook-signing-keys Demonstrates how to retrieve webhook signing keys using HttpClient in C#. Ensure to replace placeholder credentials and webhook ID. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://api.configcat.com/v1/webhooks/:webhookId/keys"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Basic PHVzZXJuYW1lPjo8cGFzc3dvcmQ+"); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Install ConfigCat Node.js SDK Source: https://configcat.com/docs/sdk-reference/node Install the legacy ConfigCat Node.js SDK using NPM. ```bash npm i configcat-node ``` -------------------------------- ### C# HttpClient Example Source: https://configcat.com/docs/api/reference/get-pending-invitations-org This C# code snippet demonstrates how to use HttpClient to make a GET request to the pending invitations endpoint. It includes setting the Accept and Authorization headers. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://api.configcat.com/v1/organizations/:organizationId/invitations"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Basic PHVzZXJuYW1lPjo8cGFzc3dvcmQ+"); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Go gRPC Client Example Source: https://configcat.com/docs/advanced/proxy/grpc Example of how to establish a gRPC connection and evaluate a feature flag using a generated Go client. ```APIDOC ## Client Usage ### Establish Connection ```go conn, err := grpc.NewClient("localhost:50051", \ grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{ \ // Any TLS options \ }))) if err != nil { panic(err) } defer func() { _ = conn.Close() }() ``` ### Evaluate Flag ```go client := proto.NewFlagServiceClient(conn) ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() resp, err := client.EvalFlag(ctx, &proto.EvalRequest{ Target: &proto.Target{Identifier: &proto.Target_SdkKey{SdkKey: "#YOUR-SDK-KEY#"}}, // Or with SDK identifier // Target: &proto.Target{Identifier: &proto.Target_SdkId{SdkId: "#SDK-IDENTIFIER#"}}, Key: "", User: map[string]*proto.UserValue{"Identifier": {Value: &proto.UserValue_StringValue{StringValue: ""}}}, }) if err != nil { panic(err) } fmt.Printf("Evaluation result: %v", resp.GetBoolValue()) ``` ``` -------------------------------- ### Get Integration using HttpClient in C# Source: https://configcat.com/docs/api/reference/get-integration This C# example demonstrates how to fetch integration metadata using `HttpClient`. Ensure the `Authorization` header is correctly set with your Basic credentials. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://api.configcat.com/v1/integrations/:integrationId"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Basic PHVzZXJuYW1lPjo8cGFzc3dvcmQ+"); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Install ConfigCat Node.js SDK Source: https://configcat.com/docs/advanced/migration-from-launchdarkly Use npm to uninstall the LaunchDarkly SDK and install the ConfigCat Node.js SDK. ```bash npm uninstall @launchdarkly/node-server-sdk npm install configcat-node ``` -------------------------------- ### Get Boolean Setting Value Source: https://configcat.com/docs/sdk-reference/go Retrieve a boolean setting value from ConfigCat. Provide the setting key and a default value. This example demonstrates how to use the retrieved value to conditionally execute code. ```go isMyAwesomeFeatureEnabled := client.GetBoolValue("isMyAwesomeFeatureEnabled", false, nil) if isMyAwesomeFeatureEnabled { doTheNewThing() } else { doTheOldThing() } ``` -------------------------------- ### Initialize Custom ConfigCat Client in Go Source: https://configcat.com/docs/sdk-reference/go Use `NewCustomClient` to create a ConfigCat client with custom configurations like SDK key, polling mode, and logger. Ensure the client is treated as a singleton. ```go client := configcat.NewCustomClient(configcat.Config{SDKKey: "#YOUR-SDK-KEY#", PollingMode: configcat.Manual, Logger: configcat.DefaultLogger(configcat.LogLevelInfo)}) ``` -------------------------------- ### C# HttpClient Example Source: https://configcat.com/docs/api/reference/get-predefined-variations This C# code snippet demonstrates how to use HttpClient to make a GET request to the predefined variations endpoint. Remember to replace placeholder values and handle authentication appropriately. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://api.configcat.com/v1/settings/:settingId/predefined-variations"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Basic PHVzZXJuYW1lPjo8cGFzc3dvcmQ+ অশোক"); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### C# HttpClient Example for Listing Pending Invitations Source: https://configcat.com/docs/api/reference/get-pending-invitations This C# code demonstrates how to use HttpClient to make a GET request to the pending invitations endpoint. Ensure you include the 'Accept' and 'Authorization' headers. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://configcat.com/v1/products/:productId/invitations"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Basic PHVzZXJuYW1lPjo8cGFzc3dvcmQ+ অশ"); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Bash Script for Creating Product and Config Source: https://configcat.com/docs/advanced/cli This bash script demonstrates how to create a product and then a configuration within that product using CLI commands. The IDs are captured for subsequent operations. ```bash #!/bin/bash ORGANIZATION_ID="" PRODUCT_ID=$(configcat product create -o $ORGANIZATION_ID -n "") CONFIG_ID=$(configcat config create -p $PRODUCT_ID -n "") ```