Skip to content

Instantly share code, notes, and snippets.

@levi-turner
Last active August 25, 2017 14:34
Show Gist options
  • Save levi-turner/e46672bfbe1fc8707bd0d0dc1e42c5e6 to your computer and use it in GitHub Desktop.
Save levi-turner/e46672bfbe1fc8707bd0d0dc1e42c5e6 to your computer and use it in GitHub Desktop.
# Script function: Import a QVF from disk
# Reload the app
# Publish the app
# Dependencies: Qlik CLI (https://github.com/ahaydon/Qlik-Cli)
# v0.1 - Levi Turner
# Connect to the Qlik Sense site
# Assumes executing user has sufficient permissions
Connect-Qlik -computername "SenseServer.company.com"
# Custom function for an ad-hoc reload
# Endpoint = POST /qrs/App/GUID/reload
function Custom-Reload {
[CmdletBinding()]
param (
[parameter(Mandatory=$true,ValueFromPipeline=$True,ValueFromPipelinebyPropertyName=$True,Position=0)]
[string]$id,
[switch]$wait
)
PROCESS {
$path = "/qrs/app"
If( $wait ) { $sync = "/synchronous" }
If( $id -match($script:guid) ) {
return Invoke-QlikPost "/qrs/app/$id/reload"
} else {
return Invoke-QlikPost "/qrs/app/$id/reload"
}
}
}
# Import the app and pipe the GUID to the custom function
Import-QlikApp -upload -name "test2" -file "C:\test.qvf" | Custom-Reload
# Publish and replace
Switch-QlikApp -appId $(Get-QlikApp -filter "name eq 'test'").id -id $(Get-QlikApp -filter "name eq 'test2'").id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment