Introduction to our new Public Management API

It truly is an exciting day for ConfigCat, we would like to introduce a brand new way to use our platform via our new public management API. This new feature makes it easier than ever to test and manipulate your feature flags allowing you to create, read, update and delete any entity within ConfigCat, such as Feature Flags, Configs, Environments or Products. For anyone familiar with using Public Management API systems the benefits will be beyond clear, if you are not, we will show you in this blog how you can make feature requests quickly and easily, 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 a quick start guide to get you up and running. If you are looking for more information for specifics on our new API system, please check out our new API docs.

Walkthrough of our new feature

Because this is quite a feature-rich addition, let's give it a proper walkthrough showcasing exactly how to use this service with all the preceding steps to set everything up. There are two main pieces of information we need to grab for this functionality, our SDK key which we grab from our ConfigCat dashboard, and our settingID value which we will locate via our API Public Management application of choice. For this blog, we have opted to use Postman because it's widely used and a contender for our personal favorite API collaboration platform. Safe to say you could apply most of the concepts of this guide to many other API collaboration platforms such as Insomnia and Swagger UI.

Quickly just to note, this guide assumes you are somewhat familiar with our Feature Flag service so we are not going to show how to set up your initial Feature Flag.

Familiar Territory

On your ConfigCat dashboard, click your user icon and click our fancy new API credentials tab. Once here, generate some new API Credentials, making sure to take a note of them. Please keep in mind for safety reasons you should never share your credentials information. We went ahead and deleted our credentials from this guide after we were finished. Don't you worry! ๐Ÿ˜ƒ

generating credentials

Besides our credential information, we also need to grab our SDK key. This can be found on your ConfigCat dashboard to the right of the Feature Flags & Settings tab. Once located, please take note of this for later.

sdk-key.png

Postman

Now let's hop over to Postman. Get comfortable, because this is where the rest of our guide will take place. So we can get ConfigCat and Postman to communicate with one another, we need to insert our previously located information. Create a new request, head to the Authorization tab, and select the Basic Auth Authorization Type and enter the request URL https://api.configcat.com/v1/products/.

postman-creds.png

The other value we need to add which we got from our ConfigCat Dashboard is our SDK key. under the Headers tab, add the key X-CONFIGCAT-SDKKEY, and enter your SDK key as the value.

postman-headers.png

With everything entered as described, go ahead and click the Send button. This will give you some information about your account, but the only thing you need to note is the productID.

productID.png

With our productID we can replace our requestURL with https://api.configcat.com/v1/products/{productId}/configs, while making sure to insert our located productID. Hitting Send again will list all our Configs.

configs.png

As you can see, we only have one Config setup for the sake of this demonstration. If you have more, simply take a note of the configId value from the corresponding name value you are wishing to use. Now, making sure to change your configId value, enter the following requestURL and hit Send like before. https://api.configcat.com/v1/configs/{configId}/settings

settingsID.png

As you can see from above, this has given us what we were after, our settingId value! ๐Ÿ‘ We only have one more request URL value to insert so stick with us, not long to go! Take your settingId value, and insert it into the following URL before hitting Send. https://api.configcat.com/v1/settings/{settingKeyOrId}/value

featureflag-off.png

Woohoo! We at last can see all of the valuable information from our flag that we were looking for. Note how our value is set to false in the above JSON, this shows everything is setup as intended as if we compare some of the information in our JSON to our actual feature flag, you can see the flag is also off and that the names match.

configcat-dashboard-flag-off.png

With everything all set up as intended, let's look at how we can toggle our Feature Flags using Postman. On Postman, change the request type from GET to PATCH, select the Body tab next to Headers, select the raw button, and finally set the data type to JSON. Now enter the following JSON code so we can toggle our Flag on.

What is JSON Patch?
[
{
"op": "replace",
"path": "/value",
"value": true
}
]

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

postman-flag-on.png

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

configcat-dashboard-on.png

And would you look at that, we have toggled our Feature Flag without the need of an SDK or our Dashboard, but by using our new public management API system! We hope you find this addition as exciting and useful as we do. Happy Feature Flagging!