Attached is a downloadable .mp4 video file for those who cannot view YouTube videos.
Hi and welcome to Qlik Fix. This video will demonstrate how to setup API Keys in Qlik Sense Enterprise SaaS using APIs.
For this example, I’ll be using PowerShell to send requests to a Qlik Sense Enterprise tenant. These will be the same actions that could be performed via the user interface in the Hub, but will be done via APIs instead. Here is a simple script that will allow you to generate an API key. More details can be found on Qlik.Dev, under Tutorials, and Generate Your First API Key. But I’ll show you how to find the same commands using browser developer tools.
First, in the tenant Management Console, under Integration, API Keys should be enabled here. You can find more information about this step on Qlik.Dev. The link is below. Set the max token expiration in days, and the number of API keys per user. These settings help maintain system security.
To generate an API key, From the Hub, in the profile menu, select Settings. Then API Keys. To see the API code to use, you can open Browser Developer tools in Chrome via F12 or In the browser menu under more tools and Developer Tools. Click on the Network tab. Then perform the action of getting a new API key by clicking the Generate New Key button. Give it a name, generate. Here’s the key. Now in the dev tools, the request for that command is shown. You can copy that. And pasting it here in the Powershell script, you can see that nothing has changed. So it’s the same script found in the tutorial on Qlik.Dev. Scrolling a little further down in the body, you can see name and expiry time. Run the command, And here is the current API key that’s about to expire, And here is the new API key. you would need to run this command before the API Key expires to get a new Key and update your code with the newer API Key. This is a handy method for renewing API keys that are about to expire, because you only need to visit the user interface the first time.
To demonstrate what it looks like when something goes wrong, I’ll use the wrong format in the Expiry field. First, it’s showing that the maximum number of API keys has been reached. To resolve that issue, I will delete an expired API key. Back to PowerShell and try again. This time, an “Invalid Property Value – 400” Error is given. That’s just showing that the wrong format is being used. And you can always find the correct code to be used by performing the action in the UI and copying the code from the developer tools.
I hope this helped.
If you'd like more information Search for answers using the Unified Search tool on the Support Portal. It searches across the Support Knowledge Base, Qlik Community, Qlik Help site and Qlik YouTube channels. Take advantage of the expertise of peers, product experts and technical support engineers by asking a question in a Qlik product forum on Qlik Community And don't forget to subscribe to the Support Updates Blog. Thanks for watching!