Skip to content
Adam Haydon edited this page Jun 26, 2019 · 2 revisions

Table of Contents:

Overview

Once a connection has been established, subsequent commands will be executed in the context of the user identified during authentication.

Commands in Qlik-Cli follow PowerShell's standard Verb-noun convention.

Common parameters across commands include:

  • filter: Parameter to include a filter in the command. Example usages: Get-QlikApp -filter "(stream.name eq 'Monitoring Apps')", Get-QlikTask -filter "createdDate gt '2018/01/01'"
  • full: Return the full JSON response to the PowerShell console. This allows for using the response element(s) in future commands.

Filters

Filters in Qlik-Cli build on the filtering mechanism in the Qlik Sense Repository API. This is not intended for a complete review, so consult the Help docs for a more thorough treatment of filtering.

To determine what and how to filter, it is often easiest to issue a specific GET call to return the elements which can be used in a filter.

Example:

  • Get-QlikApp -filter "name eq 'ExampleApp'" -full

Response:

id                    : 721edecf-385e-417f-922f-f71e5084b37b
createdDate           : 2018/10/07 18:59
modifiedDate          : 2018/10/07 18:59
modifiedByUserName    : INTERNAL\sa_repository
customProperties      : {}
owner                 : @{id=4656f533-d695-4959-a8de-1533bbd09ae9; userId=sa_api
                        userDirectory=INTERNAL; name=sa_api; privileges=}
name                  : ExampleApp
appId                 :
sourceAppId           : 00000000-0000-0000-0000-000000000000
targetAppId           : 00000000-0000-0000-0000-000000000000
publishTime           : 1752/12/31 19:00
published             : False
tags                  :
description           :
stream                :
fileSize              : 175293
lastReloadTime        : 2018/10/05 12:10
thumbnail             :
savedInProductVersion : 12.212.4
migrationHash         : 98d482c3f964dccf69cbfb9a00e0c048ea6eb221
dynamicColor          :
availabilityStatus    : NotApplicable
privileges            :
schemaPath            : App

Example filters:

  • Get-QlikApp -filter "fileSize eq 175293"
  • Get-QlikApp -filter "published eq false"

Pipelines

Since Qlik-Cli uses native PowerShell functionality, you can pass arguments using pipelines (symbolized by the | character). Pipelines reduce the effort needed for complex commands by passing values between commands. For further details, please reference the Microsoft Documentation on Pipelines

Examples:

Importing an app file disk and publishing it to a stream specified by name:

  • PS C:\> Import-QlikApp -file .\filename.qvf -name ExampleApp -upload | Publish-QlikApp -stream ExampleStream

Removing all apps with a specified name:

PS C:\> (Get-QlikApp -filter "name eq 'ExampleApp'").count
2
Get-QlikApp -filter "name eq 'ExampleApp'" | Remove-QlikApp

Inline Commands

Inline commands are another method of passing variables. Rather than using the | character to pass the GET response in the pipeline, use $(Command) syntax.

Example:

Create a custom property with the values which correspond to the node names of all nodes with Engine services enabled:

  • New-QlikCustomProperty -name NodeAffinity -choiceValues $(Get-QlikNode -filter "engineEnabled eq true").hostName -objectTypes App

Help / Documentation

To explore commands which are exposed, run the Get-Command -Module Qlik-Cli command in the PowerShell console.

For more details on a specific command, run the Get-Help CommandName command in the PowerShell console. Example:

PS C:\> Get-Help Connect-Qlik

NAME
    Connect-Qlik

SYNOPSIS
    Establishes a session with a Qlik Sense server, other Qlik cmdlets will use this session to invoke commands.


SYNTAX
    Connect-Qlik [[-Computername] <String>] [-TrustAllCerts] [-Username <String>] [-Certificate <X509Certificate>]
    [<CommonParameters>]

    Connect-Qlik [[-Computername] <String>] [-TrustAllCerts] [-UseDefaultCredentials] [<CommonParameters>]


DESCRIPTION
    Uses the parameter values to establish a new session with a Sense server, if a valid certificate can be found in
    the Windows certificate store it will be used unless this is overridden by the certificate parameter. If a valid
    certificate cannot be found Windows authentication will be attempted using the credentials of the user that is
    running the PowerShell console.


RELATED LINKS
    https://github.com/ahaydon/Qlik-Cli

REMARKS
    To see the examples, type: "get-help Connect-Qlik -examples".
    For more information, type: "get-help Connect-Qlik -detailed".
    For technical information, type: "get-help Connect-Qlik -full".
    For online help, type: "get-help Connect-Qlik -online"