Qlik Community

Ask a Question

Integration, Extension & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Announcements
Our May 2021 end-to-end product release from Data Integration to Data Analytics is out! READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
ghaliabed
Partner
Partner

Qlik Sense License Management through API

Hello

We are working on a project to possibly manage the assignment/removal of license using API calls and event triggered events.

The goal is to address the below cases:

  • Continued monitoring and deallocation of licenses for Users that have never used it
  • Bulk allocation/removal of licenses to users (ex: list defined in an excel sheet)
  • The assignment of a full license for users leveraging group tokens but are consuming too many shared tokens

Where can we find documentation or the correct APIs to build such features against our Qlik Sense server.

We have qliksense server running on version: Qlik Sense June 2018 12.26.1

Currently we are checking the following API calls but nothing substantial has been found yet, based on documentation found here.

  • GET     /qrs/license/loginaccessusage/{id}?privileges={appendprivileges}
  • GET   /qrs/selection/{id}/license/loginaccessusage/full?filter={filter}&orderby={orderby}&privileges={appendprivileges}

Any help on this is very appreciated

8 Replies
Levi_Turner
Employee
Employee

  • Continued monitoring and deallocation of licenses for Users that have never used it

DELETE /qrs/license/useraccesstype/ID

Example code: https://github.com/levi-turner/QlikSenseScripts/blob/master/qlik_sense_purge_unused_user_access_pass...(uses Qlik CLI)

  • Bulk allocation/removal of licenses to users (ex: list defined in an excel sheet)

Adding: POST /qrs/license/useraccesstype

Body (where ID = the ID of the user): {"user": {"id": "447d3ce4-5492-41bb-99c6-460456ae4363"}}

Removing: Same as above

weiqiang_wang
Contributor
Contributor

But why I got "(400)Bad Request" when I try to POST /qrs/license/useraccesstype with your method.

the url I am posting to is: https://***.southeastasia.cloudapp.azure.com:4242/qrs/license/useraccesstype?Xrfkey=Dorph1HyqLsZGeKg

And I found most open api end points with GET method working well, such as:

https://***.southeastasia.cloudapp.azure.com:4242/qrs/user?Xrfkey=Dorph1HyqLsZGeKg

 

 

 

ryanplkam
Partner
Partner

@Levi_Turner , I'm trying to de-allocate professional licenses based on the user's id... will this work

 

{FQDN}:4242/qrs/license/professionalaccesstype/full?Xrfkey=1234567890123456&filter=(user.id eq 'f5806d7d-6758-4422-b803-1b2fd3950fa4')

 

I tried this but it says 

Cannot convert the constant value "Guid" to the following: f5806d7d-6758-4422-b803-1b2fd3950fa4
Levi_Turner
Employee
Employee

The call for removal would be:

DELETE /qrs/license/professionalaccesstype/6fa395c1-4de6-47bf-96e1-5ca484168a9d

So you get the ID from:

GET /qrs/license/professionalaccesstype/full

do your app logic for group membership then call DELETE with the IDs from the GET 

ryanplkam
Partner
Partner

Thank you! @Levi_Turner 

babitaku
Contributor III
Contributor III

Hi @Levi_Turner ,

Endpoint  POST /qrs/license/useraccesstype allocate license for single user. 

Is there any way if we could allocate multiple users? Help would be much appreciated.

Thanks!
Babita

Levi_Turner
Employee
Employee

Option 1: Just loop over them in your code. In PowerShell it'd be something like

$ids = '1','2'

foreach ($id in $ids) {
    # Do stuff
}

But similar approaches exist in all scripting or programming languages.

Option 2: Toy with the Selection endpoint (https://help.qlik.com/en-US/sense-developer/APIs/RepositoryServiceAPI/index.html?page=1099) which allows you to do edits to multiple things. It's how the QMC works. I honestly haven't played with this approach at all myself.

 

Personally, option 1 is easier to deploy, simpler to understand and maintain, and is more conducive to adding robustness checks / logging.

babitaku
Contributor III
Contributor III

Thank you @Levi_Turner for the quick response.

But, how to call Qlik api endpoint from powershell? Also, the id which we pass in loop, is that GUID or Name?

 

Thanks!

Babita