Skip to main content

Exploring ConfigCat's Public Management API

· 6 min read
David Herbert

As customer expectations keep evolving, we are also looking for new solutions to meet these expectations.

We want to introduce an alternative way to access the features and functionality of our platform via our Public Management API.

Public Management API banner

The Public Management API makes it easier to test and control your feature flags by providing more flexibility in how you create, read, update and delete any entity within ConfigCat, such as feature flags, configs, environments, or products.

This API enables users to have a programmatic interface to access the same functionality on the ConfigCat Dashboard UI, which can be especially useful for tests, tools, or scripts. The benefits should already be obvious to anyone familiar with public API systems. However, if you are not, we'll explore how you can make feature requests quickly and easily using this feature, all without writing any external code.

We won't be going super in-depth into all the specific reasons behind each step in this post. It's more of a quick starter guide to get you up to speed. Please check out our API docs if you are looking for more information for specifics on the Public Management API.

Walkthrough of the Public Management API

The Public Management API is a feature-rich addition to ConfigCat, so let's take a walkthrough of how to use it, including all the necessary steps to set it up. We need to grab two essential pieces of information for this functionality: Our SDK key, which we get from the ConfigCat dashboard, and the setting ID value, which we'll get from our API client development tool of choice.

We have chosen Postman as our favorite API collaboration platform for this guide because it's a widely used API client tool. Nonetheless, it is safe to say you can apply most of the concepts in this guide to many other API collaboration platforms, such as Insomnia and Swagger UI.

Note: This guide assumes you are somewhat familiar with our Feature Flagging service, so we will not be going into details on how to set up your initial Feature Flag.

Creating our Public API Credentials from ConfigCat

On the ConfigCat dashboard, navigate to the user icon on the top left and click on the "My API credentials" tab.

Create API Credentials

Once there, click on the “Add Credential” button and provide a name for this credential.

Add Credential

Then generate some new API credentials and save them to your favorite key vault, as ConfigCat doesn't store your password for security purposes.

Note: If you close the credential dialog box, you won't be able to access the password anymore.

Generated Credentials

For security reasons, don't share your credentials with anyone. We went ahead and deleted the credentials after finishing this guide.

Besides our credentials, we will also need to grab our SDK key. You can find this in your ConfigCat dashboard, to the right of the Feature Flags page or Config Environment.

Get SDK Key

Accessing the ConfigCat Public Management API using Postman

secondary cover Image

Now let's hop over to Postman to gain access to the ConfigCat platform using the Public Management API. So get comfortable because this is where the rest of our guide will take place.

To get ConfigCat and Postman to communicate with one another, we need to connect them using our previously generated credentials. First, create a new request in Postman, head to the Authorization tab, select the Basic Auth Authorization Type and provide the basic auth username & password previously generated. Then in the request URL, enter https://api.configcat.com/v1/products/.

Postman Request Window

The other credential we need to add is our SDK key, which we got from our ConfigCat Dashboard. Under the Headers tab, create a new Key named “X-CONFIGCAT-SDKKEY” and enter your SDK key as the value.

Add SDK Key

Once all the credentials have been provided, click the Send request button. It will retrieve some information about your account, but you only need to note the productID.

Request Response

We can now use our productID as our request-URL endpoint, i.e., https://api.configcat.com/v1/products/{productId}/configs, making sure to replace the productID slug with the actual returned productID value. Hitting Send again will list all the available Configs in our ConfigCat Dashboard.

Product Request Response

As you can see, we have only one Config product in our ConfigCat Dashboard for this demonstration. If you have more, take note of the exact configID value from the corresponding one you wish to use.

Now that we have the configID, we can access our config settings by querying the API endpoint with it, i.e., https://api.configcat.com/v1/configs/{configId}/settings, making sure to replace the configID slug with the actual value of the recently returned configId. After which, we hit send again.

Config Settings

As you can see from above, this has given us the config details associated with our configID. We only have one more request-URL endpoint to make to get access to our feature flags, so stick around! Now copy the settingID value returned, and insert it into the request URL before hitting Send, i.e, https://api.configcat.com/v1/settings/{settingKeyOrId}/value.

Flags Info

Ta-da!!! We can now see the valuable information associated with our feature flag. We can compare some information in our JSON to our actual ConfigCat Dashboard. Notice our feature flag's name and how its value is false in the above JSON. It corresponds to everything on our Dashboard, as the Flag is off there, and the name also matches.

Feature Flag in Dashboard

With everything set up as intended, let's look at how we can toggle our Feature Flag using Postman. We'll start by first changing the request type from GET to PATCH. Then we select the Body tab next to Headers and click the raw button. Finally, we set the data type to JSON and entered the following JSON Patch code to toggle on our Flag's state.

[
{
"op": "replace",
"path": "/value",
"value": true
}
]

Once we hit Send, you will now notice that our flags retrieved value has also been updated to true.

Patch Flags Value

Let's head over to our ConfigCat Dashboard to see if the same changes have propagated.

Feature Flag in Dashboard

Now would you look at that? We have toggled our Feature Flag without needing or accessing our Dashboard simply by using the ConfigCat Public Management API!

Key Takeaways

  • The Public Management API makes it easier to test and control your feature flags
  • It provides more flexibility in how you create, read, update and delete any entity within ConfigCat, such as Feature Flags, Configs, Environments, or Products.
  • This API enables users to have a programmatic interface to access the same functionality on the ConfigCat Dashboard UI, which can be especially useful for tests, tools, or scripts.
  • To use the Public Management API, you will need to generate the API credentials from the ConfigCat Dashboard, along with the SDK key for that environment.

You can follow ConfigCat on Twitter, Facebook, LinkedIn, and GitHub to stay up-to-date with the latest feature flagging developments.