Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW

Assigning Qlik Cloud licenses using the REST connector

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
Francisco_Fernandez

Assigning Qlik Cloud licenses using the REST connector

Last Update:

Oct 14, 2022 10:47:04 AM

Updated By:

Sonja_Bauernfeind

Created date:

Oct 14, 2022 8:41:54 AM

Attachments

The purpose of this article is to show how to assign Qlik cloud licenses using the REST Connector.

Prerequisites:

 

Step by Step:

  1. Create a rest connection either using the data load editor or the data manager within an app, alternatively it can also be created from the hub by "+ add new" ➡️ "Data connection"

    Francisco_Fernandez_1-1665750096195.png

  2. Introduce the connection details.

    URL:
    https://your-tenant.us.qlikcloud.com/api/v1/licenses/assignments/actions/add


    Method:
    Post

    Request body:
    {"add":[{"type":"","subject":""}]}

    Query headers:
    Authorization 
    Bearer API KEY

    See fig 2.

    Fig 2Fig 2

     

  3. Create an app and add the following script: 

    //
    //How to ADD Licenses using the rest connector
    //

    // Subject IDP, Can be retrieved via API https://qlik.dev/apis/rest/users/#%23%2Fentries%2Fv1%2Fusers-get
    LET vsubject = 'auth0|82c666044a1f359ff49dcc9ac8200';
    let vRequestBody ='{';
    Let vRequestBody = vRequestBody&'"add":[{';
    //type of license assigned it can be "professional" or "analyzer"
    Let vRequestBody = vRequestBody&'"type":"professional",';
    Let vRequestBody = vRequestBody&'"subject":"$(vsubject)"';
    Let vRequestBody = vRequestBody&'}]';
    Let vRequestBody = vRequestBody&'}';
    let vRequestBody = replace(vRequestBody,'"', chr(34)&chr(34));

    //Endpoint used can be found here : https://qlik.dev/apis/rest/licenses/#%23%2Fentries%2Fv1%2Flicenses%2Fassignments%2Factions%2Fadd-pos...
    LIB CONNECT TO 'licensesassignmentsactionsadd';

    RestConnectorMasterTable:
    SQL SELECT
    "url",
    "__KEY_root",
    (SELECT
    "add",
    (SELECT
    "type",
    "subject"
    FROM "add" )
    FROM "data"
    )
    FROM JSON (wrap on) "root" PK "__KEY_root"
    WITH CONNECTION(
    BODY "$(vRequestBody)"
    );

 

 

*Notes:  The license assignment is based on the subject IDP. That information can be retrieved manually using the management console or using the API for users.

 

Environment

Qlik Cloud 

 

Related Content

How to Generate API Keys in Qlik Sense SaaS using APIs  
Assigning user roles 
Assigns license access to the given users API 

 

Labels (1)
Version history
Last update:
‎2022-10-14 10:47 AM
Updated by: