Skip to main content
Gertrude
Employee
Employee

Qlik-cli is a great tool to use for automating tasks or making scripting easier, in this blog post I will share 6 cool things you might not know about Qlik-cli. 

Qlik-cli, known on the command line simply as qlik, is a command line interface for Qlik cloud. It provides access to all public APIs through the command line, making it easier to perform administrative tasks. 

By now, working with Qlik-cli might be an obvious choice, to enhance your experience, here are six (6) things you might not know about Qlik-cli.

1. The alias command: 

The alias command is a customisable command that enables you to create short names for commands that are not easy to remember. For example, if you want to list 50 items you would call qlik item ls --limit 50 .  

Instead, you can create an alias i  or use any word that makes it easier for you to remember. 

To create the alias you can call:  qlik alias i item ls --limit 50
 
Therefore, next time you want to list 50 items you simply call:

 

 

qlik i

 

To see existing aliases you can call:

 

qlik alias ls

 

For more details call:

 

qlik alias --help

 

 

2. The edit command: 

This command fetches the resource and opens it in your integrated development environment (IDE). This is most likely
the editor defined by your 'EDITOR' environment variable or fall back to 'vi' for Linux or 'notepad' for Windows.

The resource will be updated according to the changes made in the editor, upon saving.
To use this command, for instance on a space, simply call:

 

 

qlik space edit <spaceid>

 

 

3. The Raw Command: 

This is an advanced command that can be used to send HTTP API requests to Qlik Cloud.
When called, this command will return the full response from the server, including pagination links.

Note:  The raw command can be used for any public API in Qlik Cloud, and not only the ones natively supported in qlik-cli.
 
As an example, you can use this command to get a response from the server on items.
To do this,  simply call:

 

 

qlik raw get v1/items

 

 
Additionally, query parameters are specified using the --query flag and a body can be specified using one of the body flags that is: body, body-file or body-values.
 
 

4.  The verbose flag: 

The verbose flag can be used to get detailed information regarding a request and response. It is very similar to what you get when you use the -v flag with curl.  To log more information about a command or operation simply add -v to the command.

For example, you can get more information upon app creation by calling:

 

 

qlik app create -v

 

 

This is the response you get:

 

 

Server-type not set, guessing "cloud"
POST https://yourtenant.qlik.com/api/v1/apps
* Establishing connection to: yourtenant.qlik.com:443
* TLS Handshake started
* TLS Handshake done (188ms), version: TLS v1.3
* Connection established (410ms)
> Host:yourtenant.qlik.com
> User-Agent: qlik-cli/2.16.0 (darwin)
> Transfer-Encoding: chunked
> Authorization: Bearer **omitted**
> Content-Type: application/json
> Referer: https://yourtenant.qlik.com
> Accept-Encoding: gzip
PAYLOAD:               
{}
< Cache-Control: no-store
< Connection: keep-alive
< Content-Length: 979
< Content-Type: application/json; charset=UTF-8
< Date: Wed, 11 Jan 2023 13:48:17 GMT
< Pragma: no-cache
< Strict-Transport-Security: max-age=15724800; includeSubDomains
Response time: 2s

Status: 200 OK
{
  "attributes": {
    "_resourcetype": "app",
    "createdDate": "2023-01-11T13:48:15.996Z",
    "custom": {},
    "description": "",
    "dynamicColor": "",
    "encrypted": true,
    "hasSectionAccess": false,
    "id": "514******",
    "isDirectQueryMode": false,
    "lastReloadTime": "",
    "modifiedDate": "2023-01-11T13:48:17.373Z",
    "name": "514fffd9-bf9c-4f95-9b59-93040211d014",
    "originAppId": "",
    "owner": "auth0|e43**********",
    "ownerId": "OwnerID",
    "publishTime": "",
    "published": false,
    "thumbnail": ""
  },
  "create": [
    {
      "canCreate": true,
      "resource": "sheet"
    },
    {
      "canCreate": true,
      "resource": "bookmark"
    },
    {
      "canCreate": true,
      "resource": "snapshot"
    },
    {
      "canCreate": true,
      "resource": "story"
    },
    {
      "canCreate": true,
      "resource": "dimension"
    },
    {
      "canCreate": true,
      "resource": "measure"
    },
    {
      "canCreate": true,
      "resource": "masterobject"
    },
    {
      "canCreate": true,
      "resource": "variable"
    }
  ],
  "privileges": [
    "read",
    "update",
    "delete",
    "reload",
    "export",
    "duplicate",
    "change_space",
    "export_reduced",
    "source"
  ]
}

 

 

And this is what you get when you create an app without the verbose flag (-v):

 

 

{                      
  "attributes": {
    "_resourcetype": "app",
    "createdDate": "2023-01-11T13:52:39.099Z",
    "custom": {},
    "description": "",
    "dynamicColor": "",
    "encrypted": true,
    "hasSectionAccess": false,
    "id": "9d*********",
    "isDirectQueryMode": false,
    "lastReloadTime": "",
    "modifiedDate": "2023-01-11T13:52:40.044Z",
    "name": "9d4c0950-ccd7-4824-9a96-db8f04a23716",
    "originAppId": "",
    "owner": "auth0|e43*********",
    "ownerId": "63*********",
    "publishTime": "",
    "published": false,
    "thumbnail": ""
  },
  "create": [
    {
      "canCreate": true,
      "resource": "sheet"
    },
    {
      "canCreate": true,
      "resource": "bookmark"
    },
    {
      "canCreate": true,
      "resource": "snapshot"
    },
    {
      "canCreate": true,
      "resource": "story"
    },
    {
      "canCreate": true,
      "resource": "dimension"
    },
    {
      "canCreate": true,
      "resource": "measure"
    },
    {
      "canCreate": true,
      "resource": "masterobject"
    },
    {
      "canCreate": true,
      "resource": "variable"
    }
  ],
  "privileges": [
    "read",
    "update",
    "delete",
    "reload",
    "export",
    "duplicate",
    "change_space",
    "export_reduced",
    "source"
  ]
}

 

 

5.  The Quiet flag:

The --quiet or -q flag is used for chaining commands. For example, to get the last updated app you can call:
 

 

 

qlik app ls -q | head -n1 | qlik app get

 

The quiet flag can also be used to only return the resource IDs for an operation. For instance, if you are creating an app and only want the appId, you can call:
 

 

qlik app create -q

 

 

6. Autocompletion: 

The autocompletion provided in Qlik-cli does not only autocomplete the known commands but can also be used to list the resource id used for a specific command. If you have configured autocompletion in your shell you can use TAB to go through space IDs for instance.

Note: Completion should be added after Qlik-cli installation. You can see this tutorial on how to add completion.

 

If you are just getting started with Qlik-cli, you can learn more here or  watch this video for an introduction to qlik-cli

Feel free to add more cool things we should know about qlik-cli.

/Gertrude.

 

5 Comments
William_Wistam
Contributor III
Contributor III

Hi @Gertrude ,

Thanks for sharing Qlik-cli article, much appreciate it. We need more articles like this.

I tried to run "qlik app ls -q | head -n1 | qlik app get" to get the last updated app but get an error message below, 'head' is not recognized. Do you know what I did wrong? The ls command by itself works fine. Thanks!

****************************************************************************************************

head : The term 'head' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify
that the path is correct and try again.
At line:1 char:18
+ qlik app ls -q | head -n1 | qlik app get
+ ~~~~
+ CategoryInfo : ObjectNotFound: (head:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

****************************************************************************************************

2,945 Views
timow
Employee
Employee

@William_Wistam  - in powershell you can use Select-Object instead of head. So this should do the same: 

qlik app ls -q | Select-Object -First 1 | qlik app get

2,891 Views
random_user_3869
Partner - Creator III
Partner - Creator III

Hello @Gertrude , about qlik cli i was wondering if there is the same limitation like in the automation about the number of run (in automation it's 100 before the price goes up)

Thank you

 

319 Views
Gertrude_W
Employee
Employee

Hey @Lessassy_3869

The quick answer is no there is no such limitation in qlik-cli, however, it will respect the rate-limiting of Qlik Cloud. So if a single user is rate limited on the number of requests, it will also impact qlik-cli.

You can read more about Qlik Cloud rate limiting here: https://qlik.dev/apis/rate-limiting/

I hope this answers your question. 

285 Views
random_user_3869
Partner - Creator III
Partner - Creator III

Hello @Gertrude_W ,

thank you for your reply.

It helps a lot !

265 Views