Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!

Qlik Sense SaaS - Automating Apps Export

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
jptneumann
Partner Ambassador
Partner Ambassador

Qlik Sense SaaS - Automating Apps Export

Last Update:

Oct 31, 2021 9:29:24 AM

Updated By:

jptneumann

Created date:

Oct 31, 2021 9:29:24 AM

SaaS-1200x628.jpg

 Developing apps in the Qlik Sense SaaS environment  may require us to make a full local copy of apps from a given Development Space , either for backup or even version control.

In general, projects developed in the SaaS environment are separated by Shared Spaces and may involve several applications. Making an OnPremise (local) backup of these applications can be an important security practice, as well as we can use it for version control, via git for example, to ensure application version control.

Looking for a solution to automate this operation, we turned to Qlik Sense APIs, which are powerful and complete, and provide many opportunities for integration and automation of activities.

To facilitate operations, we need to find a simple way to use these APIs, preferably through the use of scripts related to the operating system (Windows, Linux or MacOS), which facilitates DevOps activities as well as integration with other complementary tools. So the solution is to use Qlik-CLI .

The  Qlik-CLI  (command Qlik) is a CLI generated directly from the specifications of the API's Qlik Sense. It allows you to easily do any task in relation to Qlik Sense SaaS, taking advantage of its public APIs.

For more information about Qlik-CLI, see:

https://qlik.dev/tutorials/get-started-with-qlik-cli

QLIK-CLI

To use qlik-cli (by the qlik command ) it is necessary to have it installed and the  context  configured preferably via an  API-key . For download and more information go to  qlik-cli .

If we like, for example, to have a list of existing Spaces in Qlik Sense SaaS, we can use the command:

qlik space ls

It will then return a list of existing Spaces and their properties such as name, description, id , in json format.

 [
  {
    "createdAt": "2020-10-21T20:52:51.434Z",
    "createdBy": "Jg43p8kNVPEe6b6lenrG3rMYVfWc4gA9",
    "description": "",
    "id": "5f909fa35746dd0001289a96",
    "meta": {
      "actions": [
        "read",
        "create",
        "update",
        "delete",
        "publish"
      ],
      "assignableRoles": [
        "consumer",
        "contributor",
        "dataconsumer",
        "facilitator",
        "publisher"
      ],
      "roles": []
    },
    "name": "Clientes",
    "ownerId": "Jg43p8kNVPEe6b6lenrG3rMYVfWc4gA9",
    "tenantId": "y5XzebQnCkGBiEv5g-EG3_vMe0ZEJJ9d",
    "type": "managed",
    "updatedAt": "2020-10-21T21:35:01.104Z"
  }
]

To then handle the responses in json, we use jq . The JQ  is a JSON processor light and flexible. JQ is written in portable C, and has zero runtime dependencies. You can download a single binary. For download and more information go to  jq

To then list the Spaces and collect just the Name and Type, we can do:

qlik space ls|jq -r ".[]|.name + \" - \" + .type"

The result will then be something like:

Clientes - managed
Demo - shared
NTech - managed
Comercial NTech - shared
Demo01 - managed
DemoGov - shared
Comercio Data Drive NE - managed
CDDNE_QVDS - data
CDDNE_SOURCES - data

So we developed QlikSaaSExportSpaceApps , which is a script for windows environment (the same principles can be used in other scripting languages ​​for Mac or Linux platforms. QlikSaaSExportSpaceApps allows to export all the apps from a given Space, to your local machine. Its syntax is:

QlikSaaSExportSpaceApps.bat [SpaceName] [--nodata] [--help]

Where:

Space Name - Name of the Space where the apps for export reside. Not informed will use default script 
--nodata - perform app export without data 
--help - Help screen

The export process via QlikSaaSExportSpaceApps is as follows:

QlikSaaSExportSpaceAppsDiag.jpg

 

If you like to export the applications without the data loaded (focusing on the application and reducing occupied space), you can use the --nodata parameter .

The script is available for anyone who wants to use or learn about GitHub:

https://github.com/jptneumann/QlikSaaSExportSpaceApps

active intelligence

The process described above has to do with the concept of Active Intelligence from Qlik. It provides a state of continuous intelligence from up-to-date, real-time information to take immediate action, enabling Automation processes to respond more quickly to changing business requirements, eliminating manual resource-intensive tasks of creating a pipeline. End-to-end analytics: Moving data continuously, creating analytics-ready frameworks like warehouses and cloud lakes, enhanced analytics to drive new insights, API integration and applications to act immediately. 

That's it for today, See you next time!!!

Comments
hqx
Former Employee
Former Employee

Hi Jptneumann,

I have follow the jq installation guide using chocolate was successful, but not able to run the following:

qlik space ls|jq -r ".[]|.name + \" - \" + .type"

hqx_0-1653203558236.png

Also not able to run QlikSaaSExportSpaceApps.bat too.

hqx_1-1653203639715.png

Are you able to advise? Thank you.

0 Likes
jptneumann
Partner Ambassador
Partner Ambassador

Hello Hqx!

You must have the following requirements to work:
1) The qlik-cli installed and the context configured;
2) The jq installed (https://stedolan.github.io/jq/download/)

I saw that it is running in Power Shell. The Script was made for use in the Command Prompt. For execute in Power Shell use the following syntax:

qlik space ls|jq -r '.[]|.name + \" - \" + .type'


Best Regards,

Jean Paul

 

 

hqx
Former Employee
Former Employee

Hi Jean Paul,

Thank you for your info. I have one problem and jq was installed but not working for me.
I have installed jq using chocolate and downloaded the executed file and place it at C:\jq folder.

Qlik cli is working fine for me.

When executing the command qlik space ls|jq -r ".[]|.name + \" - \" + .type", error happen.

I think is the jq issue, can you advise?

Thank you and have a great day!
Best regards,

0 Likes
hqx
Former Employee
Former Employee

Hi Jean Paul,

In addition, try the following using jq, is working when I curl some sample from the placeholder.

hqx_0-1653358337138.png

Thank you.

Best regards,

James Wong

 

0 Likes
hqx
Former Employee
Former Employee

Hi Jean Paul,

I have changed the jq-win64.exe to jq.exe, and now it work for the command qlik space ls|jq -r ".[]|.name + \" - \" + .type"

I will proceed with the test on using the QlikSaaSExportSpaceApps.bat.

Thanks, and regards,

James Wong

 

0 Likes
hqx
Former Employee
Former Employee

Hi Jean Paul,

Try running the command: QlikSaaSExportSpaceApps.bat QlikTech --nodata

Error as follow: The syntax of the command is incorrect.

hqx_0-1653441358399.png

Is the command correct?

Thank you and have a nice day!

Best regards,

James Wong

 

0 Likes
Anonymous
Not applicable

Excellent work! Cut down a lot of time to develop an app backup solution from QS SaaS.  Good to have people in community with cli script knowledge! Thanks for posting.

0 Likes
Contributors
Version history
Last update:
‎2021-10-31 09:29 AM
Updated by: