<?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: Trigger Qlik Sense Task from .Net SDK in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/Trigger-Qlik-Sense-Task-from-Net-SDK/m-p/2452430#M20565</link>
    <description>&lt;P&gt;Sorry about the delay&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/77128"&gt;@Manish&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;You can use this code as a start point, see picture and code.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="marksouzacosta_0-1715719276065.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/166089i03F34552D99674F3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="marksouzacosta_0-1715719276065.png" alt="marksouzacosta_0-1715719276065.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;using Newtonsoft.Json.Linq;&lt;BR /&gt;using Qlik.Sense.RestClient;&lt;BR /&gt;using System.Net;&lt;BR /&gt;using System.Security;&lt;BR /&gt;&lt;BR /&gt;string qlikSenseUrl = "";&lt;BR /&gt;string userName = "";&lt;BR /&gt;string userDomain = "";&lt;BR /&gt;string userPassword = "";&lt;BR /&gt;&lt;BR /&gt;SecureString securePassword = new SecureString();&lt;BR /&gt;foreach (char c in userPassword)&lt;BR /&gt;{&lt;BR /&gt;securePassword.AppendChar(c);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;Console.WriteLine("Starting Qlik Sense Connection");&lt;BR /&gt;var restClient = new RestClient(qlikSenseUrl);&lt;BR /&gt;restClient.AsNtlmUserViaProxy(new NetworkCredential(userName, securePassword, userDomain), certificateValidation: false);&lt;BR /&gt;&lt;BR /&gt;string taskId = "b40bb9b1-a437-4554-9906-c21c8121a205";&lt;BR /&gt;&lt;BR /&gt;var executeTask = $"/qrs/task/{taskId}/start";&lt;BR /&gt;var rsp = await restClient.PostAsync&amp;lt;JObject&amp;gt;(executeTask, string.Empty);&lt;BR /&gt;&lt;BR /&gt;Console.WriteLine("Connection stabilished");&lt;BR /&gt;}&lt;BR /&gt;catch (Exception ex)&lt;BR /&gt;{&lt;BR /&gt;Console.WriteLine(ex.Message);&lt;BR /&gt;}&lt;/PRE&gt;</description>
    <pubDate>Tue, 14 May 2024 20:42:42 GMT</pubDate>
    <dc:creator>marksouzacosta</dc:creator>
    <dc:date>2024-05-14T20:42:42Z</dc:date>
    <item>
      <title>Trigger Qlik Sense Task from .Net SDK</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Trigger-Qlik-Sense-Task-from-Net-SDK/m-p/2451146#M20524</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to trigger to Qlik Sense task from c# .net code. Is there any sample code or any useful links which can help me get started?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 12:49:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Trigger-Qlik-Sense-Task-from-Net-SDK/m-p/2451146#M20524</guid>
      <dc:creator>Manish</dc:creator>
      <dc:date>2024-05-10T12:49:27Z</dc:date>
    </item>
    <item>
      <title>Re: Trigger Qlik Sense Task from .Net SDK</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Trigger-Qlik-Sense-Task-from-Net-SDK/m-p/2451276#M20531</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/77128"&gt;@Manish&lt;/a&gt;,&amp;nbsp;I believe you are talking about Qlik Sense on-prem, not Qlik Cloud.&lt;/P&gt;
&lt;P&gt;If that is the case, you have to use the QRS API:&lt;/P&gt;
&lt;P&gt;The End Point you are looking for is this one:&lt;BR /&gt;&lt;A href="https://help.qlik.com/en-US/sense-developer/February2024/APIs/RepositoryServiceAPI/index.html?page=1408" target="_blank" rel="noopener"&gt;Open API specification for Repository Main API − post /task/{id}/start | Qlik Sense for developers Help&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;To call the QRS API End Points I highly recommend the following Nuget Package:&lt;BR /&gt;&lt;A href="https://github.com/kolsrud/qlik_rest_sdk" target="_blank" rel="noopener"&gt;kolsrud/qlik_rest_sdk: SDK for accessing the Qlik Sense REST APIs (github.com)&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;The hardest part to figure out will be probably the Authentication because there are multiple ways to do that.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Note:&lt;/STRONG&gt; I think the .NET SDK does not support the QRS API, meaning, you will not be able to access Tasks from it.&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 20:31:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Trigger-Qlik-Sense-Task-from-Net-SDK/m-p/2451276#M20531</guid>
      <dc:creator>marksouzacosta</dc:creator>
      <dc:date>2024-05-10T20:31:39Z</dc:date>
    </item>
    <item>
      <title>Re: Trigger Qlik Sense Task from .Net SDK</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Trigger-Qlik-Sense-Task-from-Net-SDK/m-p/2452205#M20558</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/22035"&gt;@marksouzacosta&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for coming back to me.&lt;/P&gt;
&lt;P&gt;so my API endpoint will look like below is that correct ?&lt;/P&gt;
&lt;P&gt;&lt;A href="https://{servername}/qrs/task/{taskid}/start;" target="_blank"&gt;https://{servername}/qrs/task/{taskid}/start;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 11:16:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Trigger-Qlik-Sense-Task-from-Net-SDK/m-p/2452205#M20558</guid>
      <dc:creator>Manish</dc:creator>
      <dc:date>2024-05-14T11:16:26Z</dc:date>
    </item>
    <item>
      <title>Re: Trigger Qlik Sense Task from .Net SDK</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Trigger-Qlik-Sense-Task-from-Net-SDK/m-p/2452430#M20565</link>
      <description>&lt;P&gt;Sorry about the delay&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/77128"&gt;@Manish&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;You can use this code as a start point, see picture and code.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="marksouzacosta_0-1715719276065.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/166089i03F34552D99674F3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="marksouzacosta_0-1715719276065.png" alt="marksouzacosta_0-1715719276065.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;using Newtonsoft.Json.Linq;&lt;BR /&gt;using Qlik.Sense.RestClient;&lt;BR /&gt;using System.Net;&lt;BR /&gt;using System.Security;&lt;BR /&gt;&lt;BR /&gt;string qlikSenseUrl = "";&lt;BR /&gt;string userName = "";&lt;BR /&gt;string userDomain = "";&lt;BR /&gt;string userPassword = "";&lt;BR /&gt;&lt;BR /&gt;SecureString securePassword = new SecureString();&lt;BR /&gt;foreach (char c in userPassword)&lt;BR /&gt;{&lt;BR /&gt;securePassword.AppendChar(c);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;Console.WriteLine("Starting Qlik Sense Connection");&lt;BR /&gt;var restClient = new RestClient(qlikSenseUrl);&lt;BR /&gt;restClient.AsNtlmUserViaProxy(new NetworkCredential(userName, securePassword, userDomain), certificateValidation: false);&lt;BR /&gt;&lt;BR /&gt;string taskId = "b40bb9b1-a437-4554-9906-c21c8121a205";&lt;BR /&gt;&lt;BR /&gt;var executeTask = $"/qrs/task/{taskId}/start";&lt;BR /&gt;var rsp = await restClient.PostAsync&amp;lt;JObject&amp;gt;(executeTask, string.Empty);&lt;BR /&gt;&lt;BR /&gt;Console.WriteLine("Connection stabilished");&lt;BR /&gt;}&lt;BR /&gt;catch (Exception ex)&lt;BR /&gt;{&lt;BR /&gt;Console.WriteLine(ex.Message);&lt;BR /&gt;}&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 May 2024 20:42:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Trigger-Qlik-Sense-Task-from-Net-SDK/m-p/2452430#M20565</guid>
      <dc:creator>marksouzacosta</dc:creator>
      <dc:date>2024-05-14T20:42:42Z</dc:date>
    </item>
    <item>
      <title>Re: Trigger Qlik Sense Task from .Net SDK</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Trigger-Qlik-Sense-Task-from-Net-SDK/m-p/2452624#M20571</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/22035"&gt;@marksouzacosta&lt;/a&gt;&amp;nbsp;. It worked. Sorry but can I be a pedant and ask you to please help me the authentication code as well? Actually I don't want to use password to connect probably something with XrefKey would help or any other way you think would be best.&lt;/P&gt;
&lt;P&gt;Looking forward to your response.&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2024 10:12:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Trigger-Qlik-Sense-Task-from-Net-SDK/m-p/2452624#M20571</guid>
      <dc:creator>Manish</dc:creator>
      <dc:date>2024-05-15T10:12:02Z</dc:date>
    </item>
    <item>
      <title>Re: Trigger Qlik Sense Task from .Net SDK</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Trigger-Qlik-Sense-Task-from-Net-SDK/m-p/2452717#M20575</link>
      <description>&lt;P&gt;In this case, you can use Certificate Authentication - that is actually my favorite one.&lt;/P&gt;
&lt;P&gt;The first step is to create a Certificate File. It will look trick in a first glance, but it is not hard as it looks. I found a Community topic showing how to create a Certificate on QMC:&amp;nbsp;&lt;A href="https://community.qlik.com/t5/Official-Support-Articles/How-to-configure-Certificate-Authentication-for-Qlik-Sense/ta-p/1799913" target="_blank"&gt;How to configure Certificate Authentication for Ql... - Qlik Community - 1799913&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Now to the code. I have created two procedures to populate the RestClient depending on the parameters I have received from my appsettings.json. The code is not complete but I think it will give you the idea how you can use the Certificate Files with or without passwords:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="marksouzacosta_0-1715777949497.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/166135i6F9EEF8E1700512A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="marksouzacosta_0-1715777949497.png" alt="marksouzacosta_0-1715777949497.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;private void ConnectAsDirectConnection(RestClient restClient)&lt;BR /&gt;{&lt;BR /&gt;System.Security.Cryptography.X509Certificates.X509Certificate2Collection certs;&lt;BR /&gt;if (string.IsNullOrEmpty(CertificatePassword))&lt;BR /&gt;{&lt;BR /&gt;Log.Debug("Certificate without Password");&lt;BR /&gt;certs = RestClient.LoadCertificateFromDirectory(CertificatePath);&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;Log.Debug("Certificate with Password");&lt;BR /&gt;certs = RestClient.LoadCertificateFromDirectory(CertificatePath, SecureString(CertificatePassword));&lt;BR /&gt;}&lt;BR /&gt;restClient.AsDirectConnection(UserDomain,UserName,CertificatePort, CertificateValidation, certs);&lt;BR /&gt;}&lt;BR /&gt;private void ConnectAsNtlmUserViaProxy(RestClient restClient)&lt;BR /&gt;{&lt;BR /&gt;Log.Debug("User Credentials");&lt;BR /&gt;restClient.AsNtlmUserViaProxy(new NetworkCredential(UserName, SecurePassword, UserDomain), certificateValidation: false);&lt;BR /&gt;}&lt;BR /&gt;private SecureString SecureString(string str)&lt;BR /&gt;{&lt;BR /&gt;var securePassword = new SecureString();&lt;BR /&gt;foreach (var c in str.ToCharArray())&lt;BR /&gt;{&lt;BR /&gt;securePassword.AppendChar(c);&lt;BR /&gt;}&lt;BR /&gt;return securePassword;&lt;BR /&gt;}&lt;/PRE&gt;
&lt;P&gt;This is my appsettings.json populated to connect using Certificate:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="marksouzacosta_1-1715778166907.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/166136i08391D98C1D4F4A5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="marksouzacosta_1-1715778166907.png" alt="marksouzacosta_1-1715778166907.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Note that the CertificatePath can be a local Windows folder or a network folder.&lt;/P&gt;
&lt;P&gt;Please let me know if that covers what you are looking for.&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2024 13:04:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Trigger-Qlik-Sense-Task-from-Net-SDK/m-p/2452717#M20575</guid>
      <dc:creator>marksouzacosta</dc:creator>
      <dc:date>2024-05-15T13:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: Trigger Qlik Sense Task from .Net SDK</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Trigger-Qlik-Sense-Task-from-Net-SDK/m-p/2452721#M20576</link>
      <description>&lt;P&gt;You can also find another example at Qlik Rest SDK documentation:&lt;BR /&gt;&lt;A href="https://github.com/kolsrud/qlik_rest_sdk/blob/master/Qlik.Sense.RestClient/Examples/BasicConnectionCertificateFromFile/Program.cs" target="_blank"&gt;qlik_rest_sdk/Qlik.Sense.RestClient/Examples/BasicConnectionCertificateFromFile/Program.cs at master · kolsrud/qlik_rest_sdk (github.com)&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2024 13:07:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Trigger-Qlik-Sense-Task-from-Net-SDK/m-p/2452721#M20576</guid>
      <dc:creator>marksouzacosta</dc:creator>
      <dc:date>2024-05-15T13:07:49Z</dc:date>
    </item>
  </channel>
</rss>

