<?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: Need a sample code to do a PUT request with QRS API for updating User Accesses in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/Need-a-sample-code-to-do-a-PUT-request-with-QRS-API-for-updating/m-p/1419794#M8787</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This project contains code for executing POST methods. PUT should be analogous: &lt;A href="http://branch.qlik.com/#!/project/59ce1622a0aba0f9fe3a644e" title="http://branch.qlik.com/#!/project/59ce1622a0aba0f9fe3a644e"&gt;Qlik Branch&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It uses the method &lt;A href="https://msdn.microsoft.com/en-us/library/system.net.webclient.uploadstring(v=vs.110).aspx" title="https://msdn.microsoft.com/en-us/library/system.net.webclient.uploadstring(v=vs.110).aspx"&gt;WebClient.UploadString Method (System.Net)&lt;/A&gt; to do the post. There is an overload for that method that I believe can be used to do a PUT instead.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For serialization and deserialization of JSON I would recommend going with some standard library. Here is one example: &lt;A href="https://www.newtonsoft.com/json/help/html/DeserializeObject.htm" title="https://www.newtonsoft.com/json/help/html/DeserializeObject.htm"&gt;Deserialize an Object&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 06 Nov 2017 14:25:04 GMT</pubDate>
    <dc:creator>Øystein_Kolsrud</dc:creator>
    <dc:date>2017-11-06T14:25:04Z</dc:date>
    <item>
      <title>Need a sample code to do a PUT request with QRS API for updating User Accesses</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Need-a-sample-code-to-do-a-PUT-request-with-QRS-API-for-updating/m-p/1419793#M8786</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Can someone provide a sample code for using a PUT method in C#.Net?&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;How to do the structuring of a nested element in GET request to read the response?&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="text-decoration: underline;"&gt;For Eg:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;"tags": [&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "id": ".......................ID Value.................",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "name": "TagName",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "privileges": null&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;For reading the above response in JSON, how to write a class for the inner attributes of Tag attribute?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Currently this is how I am able to read the other properties:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string id { get; set; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string userId { get; set; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string userDirectory { get; set; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string name { get; set; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string privileges { get; set; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string schemaPath { get; set; }&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Nov 2017 12:20:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Need-a-sample-code-to-do-a-PUT-request-with-QRS-API-for-updating/m-p/1419793#M8786</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-06T12:20:12Z</dc:date>
    </item>
    <item>
      <title>Re: Need a sample code to do a PUT request with QRS API for updating User Accesses</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Need-a-sample-code-to-do-a-PUT-request-with-QRS-API-for-updating/m-p/1419794#M8787</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This project contains code for executing POST methods. PUT should be analogous: &lt;A href="http://branch.qlik.com/#!/project/59ce1622a0aba0f9fe3a644e" title="http://branch.qlik.com/#!/project/59ce1622a0aba0f9fe3a644e"&gt;Qlik Branch&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It uses the method &lt;A href="https://msdn.microsoft.com/en-us/library/system.net.webclient.uploadstring(v=vs.110).aspx" title="https://msdn.microsoft.com/en-us/library/system.net.webclient.uploadstring(v=vs.110).aspx"&gt;WebClient.UploadString Method (System.Net)&lt;/A&gt; to do the post. There is an overload for that method that I believe can be used to do a PUT instead.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For serialization and deserialization of JSON I would recommend going with some standard library. Here is one example: &lt;A href="https://www.newtonsoft.com/json/help/html/DeserializeObject.htm" title="https://www.newtonsoft.com/json/help/html/DeserializeObject.htm"&gt;Deserialize an Object&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Nov 2017 14:25:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Need-a-sample-code-to-do-a-PUT-request-with-QRS-API-for-updating/m-p/1419794#M8787</guid>
      <dc:creator>Øystein_Kolsrud</dc:creator>
      <dc:date>2017-11-06T14:25:04Z</dc:date>
    </item>
    <item>
      <title>Re: Need a sample code to do a PUT request with QRS API for updating User Accesses</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Need-a-sample-code-to-do-a-PUT-request-with-QRS-API-for-updating/m-p/1419795#M8788</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG style="font-size: 11.7px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Hi &lt;A href="https://community.qlik.com/people/yko"&gt;yko&lt;/A&gt; Thanks for replying.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black;"&gt;I went through the project you have attached.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black;"&gt;I am using HttpWebRequests and I am trying to fire a PUT request with a JSON body that is required for updating the information of a user. Whenever I am doing a PUT request. I am seeing two errors on it. The error and the exceptions are as follow:&lt;BR /&gt;1.) A GET request has to be made in order to make a PUT request(as the resolution I applied a GET method before the PUT method and I used the same HttpWebRequest object to modify the call as PUT but that is getting stuck on an exception that says “System.InvalidOperationException” )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black;"&gt;2.) System.InvalidOperationException is not letting me add a request body with a PUT request.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black;"&gt;3.) Parameters being provided with the requests are Method, Accept(Content-Type), Headers(Xrfkey), client issued certificate, X-Qlik-User(userDirectory and userId), writing the request stream with stream.write(jsonData, 0, jsonData.Length)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.5pt; font-family: Consolas; color: black;"&gt;Any quick suggestion w.r.t will be appreciated.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Nov 2017 14:49:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Need-a-sample-code-to-do-a-PUT-request-with-QRS-API-for-updating/m-p/1419795#M8788</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-08T14:49:52Z</dc:date>
    </item>
    <item>
      <title>Re: Need a sample code to do a PUT request with QRS API for updating User Accesses</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Need-a-sample-code-to-do-a-PUT-request-with-QRS-API-for-updating/m-p/1419796#M8789</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm no expert on the HttpWebRequest class, but I think you need to be careful when reusing the same request object multiple times. There are some caveats there:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/2179626/am-i-able-to-reuse-a-httpwebrequest" title="https://stackoverflow.com/questions/2179626/am-i-able-to-reuse-a-httpwebrequest"&gt;.net - Am I able to reuse a HttpWebRequest? - Stack Overflow&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I personally find the WebClient class to be easier to work with as it provides some useful abstractions on top of the requests that fit well with for instance Qliks REST APIs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your observation on having to do a "GET" before doing a "PUT" is correct though. When you do the first Get, you will get a cookie from Qlik that is used for authentication, and that cookie needs to be included in any following non-get operations. I actually had that flow automated in that project I linked to, but realized that I never pushed my fix. Thanks for pointing that out!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Nov 2017 08:41:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Need-a-sample-code-to-do-a-PUT-request-with-QRS-API-for-updating/m-p/1419796#M8789</guid>
      <dc:creator>Øystein_Kolsrud</dc:creator>
      <dc:date>2017-11-13T08:41:46Z</dc:date>
    </item>
  </channel>
</rss>

