<?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: Question about QSR API in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/Question-about-QSR-API/m-p/2476488#M21097</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/230976"&gt;@Bo_PT&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;I think you are missing &lt;STRONG&gt;userId&lt;/STRONG&gt; and&amp;nbsp;&lt;STRONG&gt;userDirectory&lt;/STRONG&gt; fields. I think they are required according to this reference:&lt;BR /&gt;&lt;A href="https://help.qlik.com/en-US/sense-developer/May2023/APIs/RepositoryServiceAPI/index.html?page=1911" target="_blank" rel="noopener"&gt;https://help.qlik.com/en-US/sense-developer/May2023/APIs/RepositoryServiceAPI/index.html?page=1911&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Aug 2024 13:44:36 GMT</pubDate>
    <dc:creator>marksouzacosta</dc:creator>
    <dc:date>2024-08-15T13:44:36Z</dc:date>
    <item>
      <title>Question about QSR API</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Question-about-QSR-API/m-p/2476312#M21088</link>
      <description>&lt;DIV&gt;Hi,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;I am implementing QSR API features with .NET SDK to start Qlik Sense task and assign user license. I followed instructions on this page: &lt;A href="https://help.qlik.com/en-US/sense-developer/May2023/APIs/RepositoryServiceAPI/index.html?page=1753" target="_blank"&gt;https://help.qlik.com/en-US/sense-developer/May2023/APIs/RepositoryServiceAPI/index.html?page=1753&lt;/A&gt;.&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;The starting task part works well but the assigning license part does not. Here is my code:&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;public void DoWork(string qsserver, string taskid, string uid)&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var restClient = new RestClient(qsserver);&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; restClient.AsNtlmUserViaProxy();&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string taskinfo_json = restClient.Get("/qrs/reloadtask/" + taskid);&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.Web.Script.Serialization.JavaScriptSerializer serializer =&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; new System.Web.Script.Serialization.JavaScriptSerializer();&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; QSTaskInfo qstaskInfo = serializer.Deserialize&amp;lt;QSTaskInfo&amp;gt;(taskinfo_json);&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string taskstatuscode = qstaskInfo.Operational.LastExecutionResult.Status;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; &amp;nbsp; &amp;nbsp; if ( taskstatuscode == "8")&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;restClient.Post("/qrs/task/" + taskid + "/start");&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// The code above work well&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; &amp;nbsp; &amp;nbsp; /// The following code do not work&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string body = "{";&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; body += "\"user\":{";&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; body += "\"id\":\"" + uid + "\"}";&amp;nbsp; &amp;nbsp; //uid is in format like e85cbb9e-b4cd-40b6-9687-1e7a0dc0a5c3&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; body += "}";&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; &amp;nbsp; &amp;nbsp; /// This line throws error: 404 bad content&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string result_json = restClient.Post("/qrs/license/analyzeraccesstype/", body);&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;I am not sure what I missed or did wrong. Any help is appreciated.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Thanks&lt;/DIV&gt;</description>
      <pubDate>Wed, 14 Aug 2024 13:28:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Question-about-QSR-API/m-p/2476312#M21088</guid>
      <dc:creator>Bo_PT</dc:creator>
      <dc:date>2024-08-14T13:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: Question about QSR API</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Question-about-QSR-API/m-p/2476416#M21093</link>
      <description>&lt;P&gt;I'm afraid I'm not familiar with that particular endpoint, but I have some ideas about what you could look into:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Are you sure you should use the POST endpoint? If you are assigning a new access, then perhaps you should be using a PUT endpoint instead?&lt;/LI&gt;
&lt;LI&gt;When updating an entity you often need to set the "modifiedDate" value as that is used to avoid conflict. If the "modifiedDate" value is smaller than the original value then it would be considered a conflict and you get an error. I think you typically get the "409 Conflict" in that case though and not a 404, but it could be worth to keep this in mind.&lt;/LI&gt;
&lt;LI&gt;Perhaps there's more info you need in that body? I see the properties of the "LicenseAnalyzerAccessType" structure are marked as "optional", but that doesn't necessarily mean that they are optional when calling a particular endpoint. I typically resort to reverse engineering the traffic in the QMC to resolve what is needed, but you can also try to simply define everything and see if that does the trick.&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Thu, 15 Aug 2024 06:51:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Question-about-QSR-API/m-p/2476416#M21093</guid>
      <dc:creator>Øystein_Kolsrud</dc:creator>
      <dc:date>2024-08-15T06:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: Question about QSR API</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Question-about-QSR-API/m-p/2476418#M21094</link>
      <description>&lt;P&gt;Another thing: I find that a rather nice way to define those bodies are to use the anonymous object type in C#. You can turn those into a JObject and then pass it on as a body. Like this:&lt;/P&gt;
&lt;PRE&gt;var body = JObject.FromObject(new&lt;BR /&gt;{&lt;BR /&gt;    user = new { id = uid }&lt;BR /&gt;});&lt;BR /&gt;restClient.Post("/qrs/license/analyzeraccesstype/", body);&lt;/PRE&gt;
&lt;P&gt;That way you can avoid all that convoluted string concatenation. I find it's very easy to miss a bracket or comma or something when I use that approach.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2024 14:12:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Question-about-QSR-API/m-p/2476418#M21094</guid>
      <dc:creator>Øystein_Kolsrud</dc:creator>
      <dc:date>2024-08-15T14:12:42Z</dc:date>
    </item>
    <item>
      <title>Re: Question about QSR API</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Question-about-QSR-API/m-p/2476483#M21095</link>
      <description>&lt;P&gt;&lt;SPAN&gt;HI,&amp;nbsp;&amp;nbsp;Øystein_Kolsrud thanks for your reply and tips. I will try that.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Also I want to correct one typo error: The error I got is 400: bad request. (not 404).&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2024 13:19:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Question-about-QSR-API/m-p/2476483#M21095</guid>
      <dc:creator>Bo_PT</dc:creator>
      <dc:date>2024-08-15T13:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: Question about QSR API</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Question-about-QSR-API/m-p/2476488#M21097</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/230976"&gt;@Bo_PT&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;I think you are missing &lt;STRONG&gt;userId&lt;/STRONG&gt; and&amp;nbsp;&lt;STRONG&gt;userDirectory&lt;/STRONG&gt; fields. I think they are required according to this reference:&lt;BR /&gt;&lt;A href="https://help.qlik.com/en-US/sense-developer/May2023/APIs/RepositoryServiceAPI/index.html?page=1911" target="_blank" rel="noopener"&gt;https://help.qlik.com/en-US/sense-developer/May2023/APIs/RepositoryServiceAPI/index.html?page=1911&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2024 13:44:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Question-about-QSR-API/m-p/2476488#M21097</guid>
      <dc:creator>marksouzacosta</dc:creator>
      <dc:date>2024-08-15T13:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: Question about QSR API</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Question-about-QSR-API/m-p/2476496#M21099</link>
      <description>&lt;P&gt;Thanks all for your reply. I haven't tried JObject thing yet but tried others. Here is the body part:&lt;/P&gt;
&lt;P&gt;string body = "{";&lt;BR /&gt;body += "\"id\":\"" + uid + "\",";&lt;BR /&gt;body += "\"modifiedDate\":\"2024-08-14T04:56:07.000+00:00\",";&lt;BR /&gt;body += "\"user\":{";&lt;BR /&gt;body += "\"id\":\"" + uid + "\","; &lt;BR /&gt;body += "\"userId\":\"" + userid + "\","; &lt;BR /&gt;body += "\"userDirectory\":\"" + domainname + "\"}"; &lt;BR /&gt;body += "}";&lt;/P&gt;
&lt;P&gt;I still got 400 error.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2024 14:15:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Question-about-QSR-API/m-p/2476496#M21099</guid>
      <dc:creator>Bo_PT</dc:creator>
      <dc:date>2024-08-15T14:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: Question about QSR API</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Question-about-QSR-API/m-p/2476605#M21106</link>
      <description>&lt;P&gt;It works now. It turned out that there is a special character in uid which was somehow generated during copy &amp;amp; paste. It looks like letter 'a' which is why I missed it. Normally this type of character is only generated by foreign language input method, which I do not have on my laptop. Not sure how this happened.&lt;/P&gt;
&lt;P&gt;Id, userid and userDirectory must be set to make it work. Other properties are optional. Here is the working code with minimum properties:&lt;/P&gt;
&lt;P&gt;string body = "{";&lt;BR /&gt;body += "\"user\":{";&lt;BR /&gt;body += "\"id\":\"" + uid + "\","; &lt;BR /&gt;body += "\"userId\":\"" + userid + "\",";&lt;BR /&gt;body += "\"userDirectory\":\"" + domainname + "\"}";&lt;BR /&gt;body += "}";&lt;/P&gt;
&lt;P&gt;And JObject works too.&lt;/P&gt;
&lt;P&gt;string uid = "&amp;lt;uid&amp;gt;"; &lt;BR /&gt;string userid = "&amp;lt;userid&amp;gt;";&lt;BR /&gt;string udirectory = "&amp;lt;domainname&amp;gt;";&lt;/P&gt;
&lt;P&gt;var body = JObject.FromObject(new&lt;BR /&gt;{&lt;BR /&gt;user = new { id = uid, userid = userid, userDirectory = udirectory }&lt;BR /&gt;});&lt;/P&gt;
&lt;P&gt;Thanks again for everyone.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2024 12:15:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Question-about-QSR-API/m-p/2476605#M21106</guid>
      <dc:creator>Bo_PT</dc:creator>
      <dc:date>2024-08-16T12:15:56Z</dc:date>
    </item>
  </channel>
</rss>

