Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
adamb14
Contributor II
Contributor II

PowerShell - App: Export app (call 2 of 2) - How to reference the exported ticket ID from step 1? (automated run)

https://help.qlik.com/en-US/sense-developer/2.2/Subsystems/RepositoryServiceAPI/Content/RepositorySe...

Download an existing app, identified by {appId}, using an {exportTicketId}.

Information noteHow do I reference the ticket ID returned in call 1 of 2 in the next line? 
 
Call 1: /qrs/app/{id}/export
Returns: GUID (that is, an export ticket)
Call 2: /qrs/download/app/{appId}/{exportTicketId}/{fileName}
 
Sorry new to powershell and this has got me stumped, done some searching on using the returned GUID but i'm more confused... 😄
 
 
 
Labels (1)
1 Solution

Accepted Solutions
Qlik_Eric_Thomas

Hi Adam,

Maybe the script provided as the solution here may get you in the right direction: https://community.qlik.com/t5/Integration-Extension-APIs/QRS-Export-App-without-data/td-p/128474

$hdrs = @{}


$hdrs.Add("X-Qlik-Xrfkey","examplexrfkey123")


$hdrs.Add("X-Qlik-User", "UserDirectory=INTERNAL; UserId=sa_api")


$cert = Get-ChildItem -Path "Cert:\CurrentUser\My" | Where {$_.Subject -like '*QlikClient*'}


$body = '{}'


$Data = Get-Content C:\ProgramData\Qlik\Sense\Host.cfg


$FQDN = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($($Data)))


[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12'


$guid = [guid]::NewGuid()


$download = Invoke-RestMethod -Uri "https://$($FQDN):4242/qrs/App/c9fadcd3-20f5-434b-a0f8-a73e46943294/export/$($guid)?xrfkey=examplexrf..." -Method Post -Body $body -Headers $hdrs -ContentType 'application/json' -Certificate $cert


Invoke-RestMethod -Uri "https://$($FQDN):4242$($download.downloadPath)" -Method Get -Headers $hdrs -ContentType 'application/json' -Certificate $cert |  Set-Content small.qvf -Encoding Ascii


Also, the API Endpoint you are currently using is not the suggested method for exporting apps. See these resources:

https://help.qlik.com/en-US/sense-developer/February2023/Subsystems/RepositoryServiceAPI/Content/Sen...

https://help.qlik.com/en-US/sense-developer/February2023/APIs/RepositoryServiceAPI/index.html?page=9...

https://help.qlik.com/en-US/sense-developer/February2023/APIs/RepositoryServiceAPI/index.html?page=6...

 

Sr. Technical Support Engineer with Qlik Support
Help users find answers! Don't forget to mark a solution that worked for you!

View solution in original post

1 Reply
Qlik_Eric_Thomas

Hi Adam,

Maybe the script provided as the solution here may get you in the right direction: https://community.qlik.com/t5/Integration-Extension-APIs/QRS-Export-App-without-data/td-p/128474

$hdrs = @{}


$hdrs.Add("X-Qlik-Xrfkey","examplexrfkey123")


$hdrs.Add("X-Qlik-User", "UserDirectory=INTERNAL; UserId=sa_api")


$cert = Get-ChildItem -Path "Cert:\CurrentUser\My" | Where {$_.Subject -like '*QlikClient*'}


$body = '{}'


$Data = Get-Content C:\ProgramData\Qlik\Sense\Host.cfg


$FQDN = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($($Data)))


[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12'


$guid = [guid]::NewGuid()


$download = Invoke-RestMethod -Uri "https://$($FQDN):4242/qrs/App/c9fadcd3-20f5-434b-a0f8-a73e46943294/export/$($guid)?xrfkey=examplexrf..." -Method Post -Body $body -Headers $hdrs -ContentType 'application/json' -Certificate $cert


Invoke-RestMethod -Uri "https://$($FQDN):4242$($download.downloadPath)" -Method Get -Headers $hdrs -ContentType 'application/json' -Certificate $cert |  Set-Content small.qvf -Encoding Ascii


Also, the API Endpoint you are currently using is not the suggested method for exporting apps. See these resources:

https://help.qlik.com/en-US/sense-developer/February2023/Subsystems/RepositoryServiceAPI/Content/Sen...

https://help.qlik.com/en-US/sense-developer/February2023/APIs/RepositoryServiceAPI/index.html?page=9...

https://help.qlik.com/en-US/sense-developer/February2023/APIs/RepositoryServiceAPI/index.html?page=6...

 

Sr. Technical Support Engineer with Qlik Support
Help users find answers! Don't forget to mark a solution that worked for you!