There is a massive amount of information that can be loaded directly into your Sense apps from the Qlik Cloud API. If you have been loading from the Licences endpoint though you may have noticed a change to the response since yesterday. The userId and name fields in the response have now been replaced with subject, potentially breaking your script.
Background to Using the API
The Qlik SaaS API can be used for retrieving information regarding your SaaS environment and also for making changes in your environment, such as allocating permissions. The endpoints available to end-users are the same endpoints that Qlik use to build the product. You can interact with these via REST connectors, Qlik Automations and third party tools; such as Göran Sander’s Ctrl+Q. I have blogged previously on using these APIs in the Sense load script, and describe the process of setting up and calling them in my post on Monitoring and Notifying Sense Capacity Licence Usage in Qlik Cloud. If you are not yet using APIs in your own applications then you might want to start there.
Required Changes to Fix Broken Loads
Quick Intelligence provide a free download of what we call the Instant Qlik Sense Application. This is a Sense application template, which ships with a number of example load scripts and configuration files. Two of these example scripts are for monitoring Qlik SaaS usage and sessions. Both of these scripts have been broken by the change to the API.
Fortunately the change to the API endpoint is relatively minor and the fix simple. The revised documentation for the endpoint can be found here https://qlik.dev/apis/rest/licenses.
If you wish to modify the script in a an app you already have running you simply need to find the Licences part of the script and change references to userId and UserId to subject and Subject respectively, and then remove references to name and User Name.
There is a further gotcha that I have spotted whilst changing this over though, and that is that the case of the subject field on the Users endpoint does not always match the case of the same field on the Licences endpoint. You should therefore add an upper statement around Subject in the creation of the mapping table and where it is used. If you are using the endpoints and associating the tables rather than mapping you will need to match the case in the tables themselves.
If you use these endpoints in your own scripts, or have downloaded an application that uses them, then you are likely going to have to make similar changes to that load script.
If you don’t yet use the Instant Qlik Sense Application then you can find out more about it, and download it from here:
If you would just like the script for using the Sessions or Usage endpoints of the API these can be downloaded here:
With the SaaS usage script and configuration file, Sense users are coloured by their licence types and if you have a mix of both analyser and capacity licencing you can ensure that the users who use the system the most are the ones who are holding analyser licences whilst occasional users can use capacity.
If you have any questions or comments on using the API or the Instant Qlik Sense Application then please use the comments section below.