<?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: Importing an app (.qvf) to Cloud tenant via API in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/Importing-an-app-qvf-to-Cloud-tenant-via-API/m-p/2030405#M17989</link>
    <description>&lt;P&gt;Here's an example using the library QlikSenseRestClient &lt;A href="https://www.nuget.org/packages/QlikSenseRestClient/" target="_blank" rel="noopener"&gt;https://www.nuget.org/packages/QlikSenseRestClient/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;var url = "&amp;lt;tenant url&amp;gt;";
var apiKey = "&amp;lt;api key&amp;gt;";
var appPath = @"C:\path\to\app.qvf";

var client = new RestClient(url);
client.AsApiKeyViaQcs(apiKey);

var appFile = File.ReadAllBytes(appPath);
var rsp = client.Post&amp;lt;JToken&amp;gt;("/api/v1/apps/import", appFile);
Console.WriteLine(rsp);
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 26 Jan 2023 14:50:32 GMT</pubDate>
    <dc:creator>Øystein_Kolsrud</dc:creator>
    <dc:date>2023-01-26T14:50:32Z</dc:date>
    <item>
      <title>Importing an app (.qvf) to Cloud tenant via API</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Importing-an-app-qvf-to-Cloud-tenant-via-API/m-p/2030285#M17982</link>
      <description>&lt;P&gt;Hi Qlik Community,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am wondering if anyone knows how to successfully import an app (.qvf) file from one's local system, to a Cloud tenant, through the Qlik API's?&lt;/P&gt;
&lt;P&gt;I have tried several different approaches, none of them seeming to work. I have then tried to reverse engineer the approach that Qlik themselves use through the GUI. From what I can see, these are the steps:&lt;BR /&gt;&lt;BR /&gt;1) POST request to API end-point "api/v1/temp-contents/files", in order to create an upload resource. Response should return a location with a file id for resource.&lt;/P&gt;
&lt;P&gt;2) PATCH request to API end-point "api/v1/temp-contents/files/{fileId}" to upload bytes of file to created resource.&lt;/P&gt;
&lt;P&gt;3) POST request to API end-point "api/v1/apps/import", with request body containing fileId, spaceId etc.&lt;BR /&gt;&lt;BR /&gt;However, this approach does not work as intended, as no response is returned from step 1.&lt;BR /&gt;&lt;BR /&gt;Therefore, I was wondering if someone knows the "correct" way to do it? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards&lt;/P&gt;
&lt;P&gt;PythonMCSJ&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2023 10:36:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Importing-an-app-qvf-to-Cloud-tenant-via-API/m-p/2030285#M17982</guid>
      <dc:creator>PythonMCSJ</dc:creator>
      <dc:date>2023-01-26T10:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: Importing an app (.qvf) to Cloud tenant via API</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Importing-an-app-qvf-to-Cloud-tenant-via-API/m-p/2030295#M17983</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/169090"&gt;@PythonMCSJ&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To import an app, you just have to do only step 3 and send the file in the POST request - you don't need to use temp-contents. It might not totally match the context of your set up, but we have a tutorial &lt;A href="https://qlik.dev/tutorials/deploy-a-qlik-sense-application-to-a-tenant/#2-deploy-the-application-to-the-shared-space" target="_self"&gt;here&lt;/A&gt;&amp;nbsp;(see section 2) which shows how to upload an app to a shared space and a standard response.&lt;/P&gt;
&lt;P&gt;Here's the command to take it from your local system and post it into the space. You can also remove the spaceId parameter to drop it into your personal space:&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;curl -L -X POST "https://&amp;lt;TARGET_TENANT&amp;gt;/api/v1/apps/import?spaceId=&amp;lt;SHARED_SPACE_ID&amp;gt;" \
--header "Content-Type: application/octet-stream" \
--header "Authorization: Bearer &amp;lt;TARGET_ACCESS_TOKEN&amp;gt;" \
--data-binary "@&amp;lt;APP_NAME&amp;gt;.qvf"&lt;/LI-CODE&gt;
&lt;P&gt;If you do want to deploy to a space then your user will need the appropriate access rights to that space.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2023 10:55:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Importing-an-app-qvf-to-Cloud-tenant-via-API/m-p/2030295#M17983</guid>
      <dc:creator>Dave_Channon</dc:creator>
      <dc:date>2023-01-26T10:55:11Z</dc:date>
    </item>
    <item>
      <title>Re: Importing an app (.qvf) to Cloud tenant via API</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Importing-an-app-qvf-to-Cloud-tenant-via-API/m-p/2030339#M17986</link>
      <description>&lt;P&gt;Hi Dave,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your reply! This is essentially the approach I have tried to implement, however I am trying to do it in C#. I am having trouble with "converting" the curl statement you posted to an equivalent using an HttpClient in C# - can you help me with that?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;
&lt;P&gt;PythonMCSJ&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2023 12:21:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Importing-an-app-qvf-to-Cloud-tenant-via-API/m-p/2030339#M17986</guid>
      <dc:creator>PythonMCSJ</dc:creator>
      <dc:date>2023-01-26T12:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: Importing an app (.qvf) to Cloud tenant via API</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Importing-an-app-qvf-to-Cloud-tenant-via-API/m-p/2030341#M17987</link>
      <description>&lt;P&gt;HI PythonMCSJ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the same http request as node.js&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="language-js" tabindex="0" data-testid="code-block"&gt;&lt;CODE&gt; const https = require('https')
 const options = {
   hostname: 'https://your-tenant.us.qlikcloud.com',
   port: 443,
   path: '/api/v1/apps/import',
   method: 'POST',
   headers: {
     'Content-Type': 'application/octet-stream',
     'Authorization': 'Bearer &amp;lt;API-key&amp;gt;'
   }
 }
 const req = https.request(options)
 req.write(streamData)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The details of the APIs can be found here&amp;nbsp;&lt;A href="https://qlik.dev/apis/rest/apps#%23%2Fentries%2Fv1%2Fapps%2Fimport-post" target="_blank"&gt;Apps | Qlik Developer Portal&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2023 12:26:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Importing-an-app-qvf-to-Cloud-tenant-via-API/m-p/2030341#M17987</guid>
      <dc:creator>Alastair_Ometis</dc:creator>
      <dc:date>2023-01-26T12:26:25Z</dc:date>
    </item>
    <item>
      <title>Re: Importing an app (.qvf) to Cloud tenant via API</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Importing-an-app-qvf-to-Cloud-tenant-via-API/m-p/2030372#M17988</link>
      <description>&lt;P&gt;I'm afraid C# is not a familiar area...all I can offer is a generated snippet using RestClient&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;var client = new RestClient("https://{{target_tenant}}.&amp;lt;qcs-region&amp;gt;.qlikcloud.com/api/v1/apps/import?spaceId={{shared_space_id}}");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Accept", "application/json");
request.AddHeader("Content-Type", "application/octet-stream");
request.AddHeader("Authorization", "Bearer {{target_access_token}}");
request.AddParameter("application/octet-stream", "&amp;lt;file contents here&amp;gt;", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2023 13:36:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Importing-an-app-qvf-to-Cloud-tenant-via-API/m-p/2030372#M17988</guid>
      <dc:creator>Dave_Channon</dc:creator>
      <dc:date>2023-01-26T13:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: Importing an app (.qvf) to Cloud tenant via API</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Importing-an-app-qvf-to-Cloud-tenant-via-API/m-p/2030405#M17989</link>
      <description>&lt;P&gt;Here's an example using the library QlikSenseRestClient &lt;A href="https://www.nuget.org/packages/QlikSenseRestClient/" target="_blank" rel="noopener"&gt;https://www.nuget.org/packages/QlikSenseRestClient/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;var url = "&amp;lt;tenant url&amp;gt;";
var apiKey = "&amp;lt;api key&amp;gt;";
var appPath = @"C:\path\to\app.qvf";

var client = new RestClient(url);
client.AsApiKeyViaQcs(apiKey);

var appFile = File.ReadAllBytes(appPath);
var rsp = client.Post&amp;lt;JToken&amp;gt;("/api/v1/apps/import", appFile);
Console.WriteLine(rsp);
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2023 14:50:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Importing-an-app-qvf-to-Cloud-tenant-via-API/m-p/2030405#M17989</guid>
      <dc:creator>Øystein_Kolsrud</dc:creator>
      <dc:date>2023-01-26T14:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: Importing an app (.qvf) to Cloud tenant via API</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Importing-an-app-qvf-to-Cloud-tenant-via-API/m-p/2030568#M17995</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much for the guidance! I managed to make it work with an HttpClient - turns out that my errors were a result of manually setting the content-type of the POST request to "application/octet-stream". Removing this, and simply uploading the appFile as in the example of&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/41242"&gt;@Øystein_Kolsrud&lt;/a&gt;, it now works as intended!&lt;BR /&gt;&lt;BR /&gt;Again, thank you very much!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;
&lt;P&gt;PythonMCSJ&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2023 20:45:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Importing-an-app-qvf-to-Cloud-tenant-via-API/m-p/2030568#M17995</guid>
      <dc:creator>PythonMCSJ</dc:creator>
      <dc:date>2023-01-26T20:45:22Z</dc:date>
    </item>
  </channel>
</rss>

