<?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: QRS API 403 error when creating tags in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/QRS-API-403-error-when-creating-tags/m-p/2026689#M17954</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/130414"&gt;@SimonMinifie&lt;/a&gt;&amp;nbsp;I tried to create a Tag with Postman. I see these differences:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;You are missing priviliges parameter as query string (I see you put it into the body, please remove it from there)&lt;/LI&gt;&lt;LI&gt;Your body has wrong structure&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Below my request&lt;BR /&gt;Url:&amp;nbsp;&lt;SPAN&gt;&lt;A href="https://qmi-qs-585b:4242/qrs/tag?Xrfkey=0123456789abcdef&amp;amp;privileges=true" target="_blank"&gt;https://qmi-qs-585b:4242/qrs/tag?Xrfkey=0123456789abcdef&amp;amp;privileges=true&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Headers:&amp;nbsp;X-Qlik-Xrfkey:&amp;nbsp;0123456789abcdef,&amp;nbsp;X-Qlik-User:&amp;nbsp;UserDirectory=qmi-qs-585b; UserId=qlik&lt;/P&gt;&lt;P&gt;Body&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{"name":"Tag"}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 17 Jan 2023 14:48:55 GMT</pubDate>
    <dc:creator>alex_colombo</dc:creator>
    <dc:date>2023-01-17T14:48:55Z</dc:date>
    <item>
      <title>QRS API 403 error when creating tags</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/QRS-API-403-error-when-creating-tags/m-p/2026583#M17953</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;Have managed to connect and retrieve data when connecting via powershell to teh QRS API, but the goal here is to automate the creating of a load of tags.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At the moment, any POST request results in a 403. Can anyone spot what I'm missing?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;$qlikserver = 'server1'&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;$xrefkey = "12345678qwertyui"&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;$url = "&lt;A href="https://server1:4242/qrs/tag?xrfkey=12345678qwertyui" target="_blank"&gt;https://server1:4242/qrs/tag?xrfkey=12345678qwertyui&lt;/A&gt;"&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;$headers = @{}&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;$headers.Add("X-Qlik-xrfkey","$xrfkey")&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;$headers.Add("X-Qlik-User","UserDirectory=Internal;UserId=sa_scheduler")&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;$headers.Add("Header","myuser")&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;$cert = Get-ChildItem -Path "Cert:\CurrentUser\My" | Where {$_.Subject -like '*QlikClient*'}&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;# Http body for REST API call&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;$httpBody = @{ id="00000000-0000-0000-0000-000000000000"}, @{ name="Tag1" }, @{ privileges="null" }, @{ impactSecurityAccess="false"}, @{ schemaPath="Tag" }, @{ modifiedbyusename=""}| ConvertTo-Json -Compress -Depth 10&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Write-Host $httpBody&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Invoke-RestMethod -Uri $url -Method POST -Headers $headers -Body $httpBody -ContentType 'application/json' -Certificate $cert&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SimonMinifie_0-1673955345465.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/98187iBEF0CB990970A0F8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SimonMinifie_0-1673955345465.png" alt="SimonMinifie_0-1673955345465.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 11:36:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/QRS-API-403-error-when-creating-tags/m-p/2026583#M17953</guid>
      <dc:creator>SimonMinifie</dc:creator>
      <dc:date>2023-01-17T11:36:05Z</dc:date>
    </item>
    <item>
      <title>Re: QRS API 403 error when creating tags</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/QRS-API-403-error-when-creating-tags/m-p/2026689#M17954</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/130414"&gt;@SimonMinifie&lt;/a&gt;&amp;nbsp;I tried to create a Tag with Postman. I see these differences:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;You are missing priviliges parameter as query string (I see you put it into the body, please remove it from there)&lt;/LI&gt;&lt;LI&gt;Your body has wrong structure&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Below my request&lt;BR /&gt;Url:&amp;nbsp;&lt;SPAN&gt;&lt;A href="https://qmi-qs-585b:4242/qrs/tag?Xrfkey=0123456789abcdef&amp;amp;privileges=true" target="_blank"&gt;https://qmi-qs-585b:4242/qrs/tag?Xrfkey=0123456789abcdef&amp;amp;privileges=true&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Headers:&amp;nbsp;X-Qlik-Xrfkey:&amp;nbsp;0123456789abcdef,&amp;nbsp;X-Qlik-User:&amp;nbsp;UserDirectory=qmi-qs-585b; UserId=qlik&lt;/P&gt;&lt;P&gt;Body&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{"name":"Tag"}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 14:48:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/QRS-API-403-error-when-creating-tags/m-p/2026689#M17954</guid>
      <dc:creator>alex_colombo</dc:creator>
      <dc:date>2023-01-17T14:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: QRS API 403 error when creating tags</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/QRS-API-403-error-when-creating-tags/m-p/2026765#M17955</link>
      <description>&lt;P&gt;Hi Alex,&lt;/P&gt;
&lt;P&gt;Thank you for the pointers, although I may have missed something as the response still remains as a 403.&lt;/P&gt;
&lt;P&gt;I'll have another play with it tomorrow and update here.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Simon&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 16:35:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/QRS-API-403-error-when-creating-tags/m-p/2026765#M17955</guid>
      <dc:creator>SimonMinifie</dc:creator>
      <dc:date>2023-01-17T16:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: QRS API 403 error when creating tags</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/QRS-API-403-error-when-creating-tags/m-p/2026796#M17956</link>
      <description>&lt;P&gt;I havent tried with PS recently but usually im getting 403 when im using the wrong certificates (or there is something&amp;nbsp; wrong with them)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Stefan&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 17:32:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/QRS-API-403-error-when-creating-tags/m-p/2026796#M17956</guid>
      <dc:creator>stefanstoichev123</dc:creator>
      <dc:date>2023-01-17T17:32:12Z</dc:date>
    </item>
    <item>
      <title>Re: QRS API 403 error when creating tags</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/QRS-API-403-error-when-creating-tags/m-p/2030084#M17981</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/130414"&gt;@SimonMinifie&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is a header called "header" not sure that was left by mistake, the other thing is that if you are reading the certificate from the cert store, make sure you run your powershell as the service account, or you can export the certificate and instead of reading from the cert store read from the exported certs (files).&lt;/P&gt;
&lt;P&gt;I did a quick test and this worked for me:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;$url = "&lt;A href="https://qlikserver3.domain.local:4242/qrs/tag?xrfkey=12345678qwertyui" target="_blank"&gt;https://qlikserver3.domain.local:4242/qrs/tag?xrfkey=12345678qwertyui&lt;/A&gt;"&lt;BR /&gt;$headers = @{}&lt;BR /&gt;$headers.Add("X-Qlik-xrfkey","12345678qwertyui")&lt;BR /&gt;$headers.Add("X-Qlik-User","UserDirectory=domain;UserId=administrator")&lt;BR /&gt;##$headers.Add("Header","myuser")&lt;BR /&gt;$cert = Get-ChildItem -Path "Cert:\CurrentUser\My" | Where {$_.Subject -like '*QlikClient*'}&lt;/P&gt;
&lt;P&gt;# Http body for REST API call&lt;BR /&gt;$httpBody = @{&lt;/P&gt;
&lt;P&gt;"name" = "SampleTag"&lt;/P&gt;
&lt;P&gt;};&lt;/P&gt;
&lt;P&gt;Write-Output $httpBody&lt;BR /&gt;Write-Output $url&lt;/P&gt;
&lt;P&gt;Invoke-RestMethod -Uri $url -Method POST -Headers $headers -Body ($httpBody|ConvertTo-Json) -ContentType 'application/json' -Certificate $cert&lt;/P&gt;
&lt;P&gt;you will get a response like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Name Value &lt;BR /&gt;---- ----- &lt;BR /&gt;name SampleTag &lt;BR /&gt;&lt;A href="https://qlikserver3.domain.local:4242/qrs/tag?xrfkey=12345678qwertyui" target="_blank"&gt;https://qlikserver3.domain.local:4242/qrs/tag?xrfkey=12345678qwertyui&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;id : 5c1f0f20-9c92-4b77-a88b-354f1f4a0d4b&lt;BR /&gt;createdDate : 2023-01-26T04:23:42.894Z&lt;BR /&gt;modifiedDate : 2023-01-26T04:23:42.894Z&lt;BR /&gt;modifiedByUserName : DOMAIN\administrator&lt;BR /&gt;name : SampleTag&lt;BR /&gt;privileges : &lt;BR /&gt;schemaPath : Tag&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope it helps!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2023 20:28:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/QRS-API-403-error-when-creating-tags/m-p/2030084#M17981</guid>
      <dc:creator>NadiaB</dc:creator>
      <dc:date>2023-01-25T20:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: QRS API 403 error when creating tags</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/QRS-API-403-error-when-creating-tags/m-p/2031245#M18002</link>
      <description>&lt;P&gt;If we look at the output you are generating with the HTTPBody&lt;/P&gt;
&lt;P&gt;We can see that this is creating an Array of 6 unique objects with one property each&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Marc_0-1675047254549.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/99095i1ADE1504828FA086/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Marc_0-1675047254549.png" alt="Marc_0-1675047254549.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;what you really want is something more along the lines of this&lt;/P&gt;
&lt;P&gt;# Http body for REST API call&lt;BR /&gt;$httpBody = @{ id="00000000-0000-0000-0000-000000000000"; name="Tag1";privileges="null"; impactSecurityAccess="false"; schemaPath="Tag"; modifiedbyusename=""}| ConvertTo-Json -Compress -Depth 10&lt;/P&gt;
&lt;P&gt;which generates 1 object with 6 properties&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Marc_1-1675047403362.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/99096i7DCA22DE896EDDD6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Marc_1-1675047403362.png" alt="Marc_1-1675047403362.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;having said that, as &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/22488"&gt;@NadiaB&lt;/a&gt;&amp;nbsp; shows in her example in order to create a new Tag you only need to supply the Tag name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or to simplify things even further.&lt;/P&gt;
&lt;P&gt;you can use one of the available PowerShell modules for interacting with the QRS APIs&amp;nbsp;&lt;A href="https://github.com/QlikProfessionalServices/QlikSenseCLI" target="_blank" rel="noopener"&gt;QlikSenseCLI&lt;/A&gt;&amp;nbsp;or&amp;nbsp;&lt;A href="https://github.com/ahaydon/Qlik-Cli-Windows" target="_self"&gt;Qlik-Cli-Windows&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in QlikSenseCLI this would look like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Import-Module C:\ExportedPath\QlikSenseCLI&lt;/P&gt;
&lt;P&gt;$ServerName = "Server1"&lt;BR /&gt;$UserName = "Internal\sa_api"&lt;BR /&gt;$Cert = Get-ChildItem -Path "Cert:\CurrentUser\My" | Where {$_.Subject -like '*QlikClient*'}&lt;BR /&gt;Connect-QlikSense -Hostname $ServerName -Username $UserName -Certificate $Cert&lt;/P&gt;
&lt;P&gt;#Create the local object&lt;BR /&gt;$NewTag = New-QSTag -Name "Tag1"&lt;/P&gt;
&lt;P&gt;#Add the Object to the Sense server&lt;BR /&gt;$QSNewTag = Add-QSTag -TagObj $NewTag&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 03:05:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/QRS-API-403-error-when-creating-tags/m-p/2031245#M18002</guid>
      <dc:creator>Marc</dc:creator>
      <dc:date>2023-01-30T03:05:36Z</dc:date>
    </item>
  </channel>
</rss>

