<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: PowerShell - App: Export app (call 2 of 2) - How to reference the exported ticket ID from step 1? (automated run) in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/PowerShell-App-Export-app-call-2-of-2-How-to-reference-the/m-p/2049526#M86268</link>
    <description>&lt;P&gt;Hi Adam,&lt;BR /&gt;&lt;BR /&gt;Maybe the script provided as the solution here may get you in the right direction:&amp;nbsp;&lt;A href="https://community.qlik.com/t5/Integration-Extension-APIs/QRS-Export-App-without-data/td-p/128474" target="_blank"&gt;https://community.qlik.com/t5/Integration-Extension-APIs/QRS-Export-App-without-data/td-p/128474&lt;/A&gt;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;$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&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;Also, the API Endpoint you are currently using is not the suggested method for exporting apps. See these resources:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://help.qlik.com/en-US/sense-developer/February2023/Subsystems/RepositoryServiceAPI/Content/Sense_RepositoryServiceAPI/RepositoryServiceAPI-App-Export-App-Two-Calls.htm" target="_blank"&gt;https://help.qlik.com/en-US/sense-developer/February2023/Subsystems/RepositoryServiceAPI/Content/Sense_RepositoryServiceAPI/RepositoryServiceAPI-App-Export-App-Two-Calls.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.qlik.com/en-US/sense-developer/February2023/APIs/RepositoryServiceAPI/index.html?page=987" target="_blank"&gt;https://help.qlik.com/en-US/sense-developer/February2023/APIs/RepositoryServiceAPI/index.html?page=987&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.qlik.com/en-US/sense-developer/February2023/APIs/RepositoryServiceAPI/index.html?page=612" target="_blank"&gt;https://help.qlik.com/en-US/sense-developer/February2023/APIs/RepositoryServiceAPI/index.html?page=612&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Mar 2023 13:18:44 GMT</pubDate>
    <dc:creator>Qlik_Eric_Thomas</dc:creator>
    <dc:date>2023-03-15T13:18:44Z</dc:date>
    <item>
      <title>PowerShell - App: Export app (call 2 of 2) - How to reference the exported ticket ID from step 1? (automated run)</title>
      <link>https://community.qlik.com/t5/App-Development/PowerShell-App-Export-app-call-2-of-2-How-to-reference-the/m-p/2049273#M86248</link>
      <description>&lt;P&gt;&lt;A href="https://help.qlik.com/en-US/sense-developer/2.2/Subsystems/RepositoryServiceAPI/Content/RepositoryServiceAPI/RepositoryServiceAPI-App-Export-App-Call-2.htm" target="_blank" rel="noopener"&gt;https://help.qlik.com/en-US/sense-developer/2.2/Subsystems/RepositoryServiceAPI/Content/RepositoryServiceAPI/RepositoryServiceAPI-App-Export-App-Call-2.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Download an existing app, identified by&amp;nbsp;&lt;SPAN class="Code"&gt;{appId}&lt;/SPAN&gt;, using an&amp;nbsp;&lt;SPAN class="Code"&gt;{exportTicketId}&lt;/SPAN&gt;.&lt;/EM&gt;&lt;/P&gt;
&lt;DIV class="note"&gt;&lt;SPAN class="sr-only"&gt;Information note&lt;/SPAN&gt;How do I reference the ticket ID returned in call 1 of 2 in the next line?&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="note"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="note"&gt;Call 1:&amp;nbsp;&lt;SPAN&gt;/qrs/app/{id}/export&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV class="note"&gt;Returns:&amp;nbsp;&lt;SPAN&gt;GUID (that is, an export ticket)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV class="note"&gt;Call 2:&amp;nbsp;&lt;SPAN&gt;/qrs/download/app/{appId}/{exportTicketId}/{fileName}&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV class="note"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="note"&gt;Sorry new to powershell and this has got me stumped, done some searching on using the returned GUID but i'm more confused... &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/DIV&gt;
&lt;DIV class="note"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="note"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="note"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Wed, 15 Mar 2023 04:53:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/PowerShell-App-Export-app-call-2-of-2-How-to-reference-the/m-p/2049273#M86248</guid>
      <dc:creator>adamb14</dc:creator>
      <dc:date>2023-03-15T04:53:25Z</dc:date>
    </item>
    <item>
      <title>Re: PowerShell - App: Export app (call 2 of 2) - How to reference the exported ticket ID from step 1? (automated run)</title>
      <link>https://community.qlik.com/t5/App-Development/PowerShell-App-Export-app-call-2-of-2-How-to-reference-the/m-p/2049526#M86268</link>
      <description>&lt;P&gt;Hi Adam,&lt;BR /&gt;&lt;BR /&gt;Maybe the script provided as the solution here may get you in the right direction:&amp;nbsp;&lt;A href="https://community.qlik.com/t5/Integration-Extension-APIs/QRS-Export-App-without-data/td-p/128474" target="_blank"&gt;https://community.qlik.com/t5/Integration-Extension-APIs/QRS-Export-App-without-data/td-p/128474&lt;/A&gt;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;$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&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;Also, the API Endpoint you are currently using is not the suggested method for exporting apps. See these resources:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://help.qlik.com/en-US/sense-developer/February2023/Subsystems/RepositoryServiceAPI/Content/Sense_RepositoryServiceAPI/RepositoryServiceAPI-App-Export-App-Two-Calls.htm" target="_blank"&gt;https://help.qlik.com/en-US/sense-developer/February2023/Subsystems/RepositoryServiceAPI/Content/Sense_RepositoryServiceAPI/RepositoryServiceAPI-App-Export-App-Two-Calls.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.qlik.com/en-US/sense-developer/February2023/APIs/RepositoryServiceAPI/index.html?page=987" target="_blank"&gt;https://help.qlik.com/en-US/sense-developer/February2023/APIs/RepositoryServiceAPI/index.html?page=987&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.qlik.com/en-US/sense-developer/February2023/APIs/RepositoryServiceAPI/index.html?page=612" target="_blank"&gt;https://help.qlik.com/en-US/sense-developer/February2023/APIs/RepositoryServiceAPI/index.html?page=612&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 13:18:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/PowerShell-App-Export-app-call-2-of-2-How-to-reference-the/m-p/2049526#M86268</guid>
      <dc:creator>Qlik_Eric_Thomas</dc:creator>
      <dc:date>2023-03-15T13:18:44Z</dc:date>
    </item>
  </channel>
</rss>

