<?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: Script Export in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/Script-Export/m-p/2503557#M21773</link>
    <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/29458"&gt;@Marc&lt;/a&gt;&amp;nbsp; for the details. Will check on the given inputs.&lt;/P&gt;</description>
    <pubDate>Wed, 29 Jan 2025 14:39:04 GMT</pubDate>
    <dc:creator>AkashPohare_HB</dc:creator>
    <dc:date>2025-01-29T14:39:04Z</dc:date>
    <item>
      <title>Script Export</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Script-Export/m-p/2494549#M21571</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;I would like to download the script from all my apps. I use NetSDK and Visual Studio for this. It works for a single defined app. However, when I iterate over the app list, I get the error message that the app is already open, although according to the console I am already at the next app.&lt;/P&gt;
&lt;P&gt;My Code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;using Qlik.Engine;
using Qlik.Sense.Client;
using System;
using System.Collections.Generic;
using System.IO;

class Program
{
    static void Main(string[] args)
    {
        string serverUri = "https://xxxxxxx.com/";
        string exportBasePath = @"C:Export\"; 

        Directory.CreateDirectory(exportBasePath);

        using (ILocation location = Qlik.Engine.Location.FromUri(new Uri(serverUri)))
        {
            location.AsNtlmUserViaProxy(certificateValidation: false);

            try
            {
                using (IHub hub = location.Hub())
                {

                    var apps = hub.GetAppList();

                    foreach (var app in apps)
                    {
                        Console.WriteLine($"App: {app.AppName}");

                        IApp appData = hub.OpenApp(app.AppId);                        

                        string script = appData.GetScript();
                        string scriptFilePath = Path.Combine(exportBasePath, $"{app.AppName}.txt");

                        File.WriteAllText(scriptFilePath, script);
                        Console.WriteLine($"  -&amp;gt; Export");

                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Fehler: {ex.Message}");
            }
        }
    }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="patrickkahle_0-1732603734611.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/174834iA407DE9E39894A2D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="patrickkahle_0-1732603734611.png" alt="patrickkahle_0-1732603734611.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would also like to put the different apps in a corresponding folder depending on their stream. It is supposed to work via the “GetAllInfos” function, but this no longer seems to exist. I am using SDK version 16.9&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks and best regards&lt;/P&gt;
&lt;P&gt;Patrick&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2024 06:57:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Script-Export/m-p/2494549#M21571</guid>
      <dc:creator>patrickkahle</dc:creator>
      <dc:date>2024-11-26T06:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: Script Export</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Script-Export/m-p/2494995#M21584</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;var exportBasePath = Directory.CreateDirectory(exportBasePath);
using (Qlik.Engine.ILocation location = Qlik.Engine.Location.FromUri(serverUri))
{
    location.AsNtlmUserViaProxy(certificateValidation: false);
    
    var qlikApps = location.GetAppIdentifiers();
    foreach (var appIdentifier in qlikApps) {
        try
        {
            Console.WriteLine($"App: {appIdentifier.AppName}");
            var qeapp = location.App(appIdentifier, Qlik.Engine.Session.Random, false);
            string script = qeapp.GetScript();
            FileInfo scriptFilePath = new FileInfo(Path.Combine(exportBasePath.FullName, appIdentifier.AppId, $"{appIdentifier.AppName}.txt"));
            scriptFilePath.Directory.Create();
            File.WriteAllText(scriptFilePath.FullName, script);
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.ToString());
        }
    }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Nov 2024 23:50:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Script-Export/m-p/2494995#M21584</guid>
      <dc:creator>Marc</dc:creator>
      <dc:date>2024-11-27T23:50:10Z</dc:date>
    </item>
    <item>
      <title>Re: Script Export</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Script-Export/m-p/2495022#M21586</link>
      <description>&lt;P&gt;Hi Marc,&lt;/P&gt;
&lt;P&gt;thank you for your code. Is it possible to replace the AppID with the stream name as the folder name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you and best regards&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Patrick&lt;/P&gt;</description>
      <pubDate>Thu, 28 Nov 2024 06:25:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Script-Export/m-p/2495022#M21586</guid>
      <dc:creator>patrickkahle</dc:creator>
      <dc:date>2024-11-28T06:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: Script Export</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Script-Export/m-p/2495066#M21590</link>
      <description>&lt;P&gt;You should be able to get the stream for which an app has been published from the "Meta" property of the appIdentifiers. Here's an example printing the names and associated streams of all apps:&lt;/P&gt;
&lt;PRE&gt;var appIds = location.GetAppIdentifiers();&lt;BR /&gt;foreach (var appId in appIds)&lt;BR /&gt;{&lt;BR /&gt;    var streamDef = appId.Meta.Get&amp;lt;JObject&amp;gt;("stream");&lt;BR /&gt;    var streamName = streamDef?["name"] ?? "&amp;lt;none&amp;gt;";&lt;BR /&gt;    Console.WriteLine($"{appId.AppName} stream={streamName}");&lt;BR /&gt;}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Nov 2024 09:05:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Script-Export/m-p/2495066#M21590</guid>
      <dc:creator>Øystein_Kolsrud</dc:creator>
      <dc:date>2024-11-28T09:05:05Z</dc:date>
    </item>
    <item>
      <title>Re: Script Export</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Script-Export/m-p/2495079#M21591</link>
      <description>&lt;P&gt;Thank you and best regards&lt;/P&gt;
&lt;P&gt;Patrick&lt;/P&gt;</description>
      <pubDate>Thu, 28 Nov 2024 10:13:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Script-Export/m-p/2495079#M21591</guid>
      <dc:creator>patrickkahle</dc:creator>
      <dc:date>2024-11-28T10:13:14Z</dc:date>
    </item>
    <item>
      <title>Re: Script Export</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Script-Export/m-p/2503221#M21766</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;Can this be done using Python and how to connect to Qlik Sense Engine API to extract the script? Currently, there is no Python SDK for Qlik Sense OnPrem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2025 09:25:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Script-Export/m-p/2503221#M21766</guid>
      <dc:creator>AkashPohare_HB</dc:creator>
      <dc:date>2025-01-28T09:25:31Z</dc:date>
    </item>
    <item>
      <title>Re: Script Export</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Script-Export/m-p/2503272#M21768</link>
      <description>&lt;P&gt;How to connect a WebSocket connection via Python is covered in the Article &lt;A href="https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/ta-p/1716089/highlight/true" target="_blank"&gt;https://community.qlik.com/t5/Official-Support-Articles/Qlik-Sense-call-Qlik-Sense-Engine-API-with-Python/ta-p/1716089/highlight/true&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;which also has some examples of how to open the app and perform activities, however for you use case you would need to send the appropriate requests over the websocket to open the doc, then request the Script,&lt;/P&gt;
&lt;P&gt;you can figure out what those are from the Engine API Explorer in dev-hub &lt;A href="https://&amp;lt;qlikSenseServer&amp;gt;/dev-hub/engine-api-explorer" target="_blank"&gt;https://&amp;lt;qlikSenseServer&amp;gt;/dev-hub/engine-api-explorer&lt;/A&gt; (among other things you might want to do)&lt;/P&gt;
&lt;P&gt;but the opendoc request would look similar to this&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;{
	"jsonrpc": "2.0",
	"id": 2,
	"delta": true,
	"result": {
		"qReturn": {
			"qType": "Doc",
			"qHandle": 1,
			"qGenericId": "b19b7875-1111-1111-1111-7c6d58377a22"
		}
	}
}&lt;/LI-CODE&gt;
&lt;P&gt;and the get script request.&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;{
	"handle": 1,
	"method": "GetScript",
	"params": {}
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2025 11:35:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Script-Export/m-p/2503272#M21768</guid>
      <dc:creator>Marc</dc:creator>
      <dc:date>2025-01-28T11:35:12Z</dc:date>
    </item>
    <item>
      <title>Re: Script Export</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Script-Export/m-p/2503557#M21773</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/29458"&gt;@Marc&lt;/a&gt;&amp;nbsp; for the details. Will check on the given inputs.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2025 14:39:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Script-Export/m-p/2503557#M21773</guid>
      <dc:creator>AkashPohare_HB</dc:creator>
      <dc:date>2025-01-29T14:39:04Z</dc:date>
    </item>
  </channel>
</rss>

