<?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: users/{id}/roles body parameter in Qlik NPrinting</title>
    <link>https://community.qlik.com/t5/Qlik-NPrinting/users-id-roles-body-parameter/m-p/1631646#M26283</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/8367"&gt;@davwade1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See attached QVF from one of my colleagues.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In any case, this comes with a caveat and should be used as is...there is no guarantee of it's success in your environment ... but it may guide you to the answers you need.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;EM&gt;The QVF (attached) contains code that pulls in Users/Roles from the QS Repository and assigns appropriate roles within NPrinting. I have highlighted the tabs relevant to Role assignment.&lt;/EM&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;EM&gt;Note: I was unable to create new roles using this script. However, I was able to assign users to existing NP roles.&lt;/EM&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN&gt;Hope this helps...if not, hopefully someone else will provide a response here for you that will be helpful.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Have a good weekend...&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 04 Oct 2019 20:55:35 GMT</pubDate>
    <dc:creator>Frank_S</dc:creator>
    <dc:date>2019-10-04T20:55:35Z</dc:date>
    <item>
      <title>users/{id}/roles body parameter</title>
      <link>https://community.qlik.com/t5/Qlik-NPrinting/users-id-roles-body-parameter/m-p/1631559#M26268</link>
      <description>&lt;P&gt;I am trying to update my Nprinting user roles from within a Qlik Sense script. I have been successful with GET and POST, but am stuck on the required BODY parameters when adding roles to a user. I read the other post about this topic but it was not helpful for me. I confirmed that the userId and roleID being used are accurate and active.&lt;/P&gt;&lt;P&gt;Here is what my script looks like now -( I changed the server names and cookie to protect the innocent &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; );&lt;/P&gt;&lt;P&gt;UpdateUser:&lt;BR /&gt;SQL SELECT&lt;BR /&gt;"__KEY_data"&lt;BR /&gt;FROM&lt;BR /&gt;JSON (wrap off) "data" PK "__KEY_data"&lt;BR /&gt;WITH CONNECTION&lt;BR /&gt;(&lt;BR /&gt;URL "&lt;A href="https://server.domain.com:4993/api/v1/users/1ed5d811-a345-52ce-ba8e-4dd6723f65905/roles" target="_blank"&gt;https://server.domain.com:4993/api/v1/users/1ed5d811-a345-52ce-ba8e-4dd6723f65905/roles&lt;/A&gt;", BODY """a4882700-d42a-4703-906c-d6104b0d012a""",&lt;BR /&gt;HTTPHEADER "Origin" "&lt;A href="https://senseserver.domain.com" target="_blank"&gt;https://senseserver.domain.com&lt;/A&gt;",&lt;BR /&gt;HTTPHEADER "Content-Type" "application/json",&lt;BR /&gt;HTTPHEADER "X-HTTP-Method-Override" "PUT",&lt;BR /&gt;HTTPHEADER "cookie" "longcookiestring; "&lt;BR /&gt;);&lt;/P&gt;&lt;P&gt;I have tried several things for the body, but they all return an error about malformed body.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Can someone please help me out and tell me what to put between the 2 double quotes after BODY? Thanks&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;FYI - Nprinting version is 19.19.4.0, QS Enterprise version is Feb 2019 and my QS REST connector is version 2.11.0&lt;/P&gt;&lt;P&gt;Below were all failures:&lt;/P&gt;&lt;P&gt;BODY "a4882700-d42a-4703-906c-d6104b0d012a"&lt;/P&gt;&lt;P&gt;BODY ""a4882700-d42a-4703-906c-d6104b0d012a""&lt;/P&gt;&lt;P&gt;BODY "'a4882700-d42a-4703-906c-d6104b0d012a'"&lt;/P&gt;&lt;P&gt;BODY "["a4882700-d42a-4703-906c-d6104b0d012a"]"&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2019 16:50:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-NPrinting/users-id-roles-body-parameter/m-p/1631559#M26268</guid>
      <dc:creator>davwade1</dc:creator>
      <dc:date>2019-10-04T16:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: users/{id}/roles body parameter</title>
      <link>https://community.qlik.com/t5/Qlik-NPrinting/users-id-roles-body-parameter/m-p/1631571#M26269</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/8367"&gt;@davwade1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please check the following article:&amp;nbsp;&lt;SPAN&gt;&lt;A href="https://support.qlik.com/articles/000059611" target="_blank"&gt;https://support.qlik.com/articles/000059611&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;It contains information about validating the version of the rest connector, and mentions QS April 2019 or later versions that contain the defect fixed version of the rest connection along with other requirements. (copy pasting the connector may not work. Using the QS installation server program will ensure it is installed correctly.)&lt;/P&gt;
&lt;P&gt;If you still have an issue after checking the above article and steps there in I would suggest starting a support ticket with Qlik or your Qlik Support partner.&lt;/P&gt;
&lt;P&gt;Kind regards...&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2019 17:04:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-NPrinting/users-id-roles-body-parameter/m-p/1631571#M26269</guid>
      <dc:creator>Frank_S</dc:creator>
      <dc:date>2019-10-04T17:04:43Z</dc:date>
    </item>
    <item>
      <title>Re: users/{id}/roles body parameter</title>
      <link>https://community.qlik.com/t5/Qlik-NPrinting/users-id-roles-body-parameter/m-p/1631574#M26270</link>
      <description>&lt;P&gt;Frank,&lt;/P&gt;&lt;P&gt;Thanks for the quick response. Our QS Feb 2019 is at patch 4 and has the "good" REST connector 2.11.0. I read the article and can confirm that the Trusted origin is setup and we are using a windows service account that has admin rights on both the QS and Nprinting applications. We have used the API with POST to reload metadata for connections, so I feel good that the setup is working correctly.&lt;/P&gt;&lt;P&gt;I was hoping that I just overlooked something obvious about the BODY syntax.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2019 17:15:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-NPrinting/users-id-roles-body-parameter/m-p/1631574#M26270</guid>
      <dc:creator>davwade1</dc:creator>
      <dc:date>2019-10-04T17:15:08Z</dc:date>
    </item>
    <item>
      <title>Re: users/{id}/roles body parameter</title>
      <link>https://community.qlik.com/t5/Qlik-NPrinting/users-id-roles-body-parameter/m-p/1631597#M26273</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/8367"&gt;@davwade1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good point re: QS Feb 2019 patch 4. I've updated the article I mentioned accordingly. I check other working code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Check out the following:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Instead of&amp;nbsp;&lt;SPAN&gt;BODY "["a4882700-d42a-4703-906c-d6104b0d012a"]"&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;Try&amp;nbsp;&lt;SPAN&gt;BODY '{"a4882700-d42a-4703-906c-d6104b0d012a"}'&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN&gt;Regards...&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2019 18:17:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-NPrinting/users-id-roles-body-parameter/m-p/1631597#M26273</guid>
      <dc:creator>Frank_S</dc:creator>
      <dc:date>2019-10-04T18:17:47Z</dc:date>
    </item>
    <item>
      <title>Re: users/{id}/roles body parameter</title>
      <link>https://community.qlik.com/t5/Qlik-NPrinting/users-id-roles-body-parameter/m-p/1631609#M26274</link>
      <description>&lt;P&gt;Thanks, but it did not like these options either.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;BODY '{"a4882700-d42a-4703-906c-d6104b0d012a"}',&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Connector reply error: Unknown substring, string, or value at (7,108): ''{"a4882700-d42a-4703-906c-d6104b0d'&lt;/P&gt;&lt;P&gt;I also tried double quotes with the curly brackets and got a similar error:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;BODY "{"a4882700-d42a-4703-906c-d6104b0d012a"}",&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Connector reply error: Unknown substring, string, or value at (7,119): '-d42a-4703-906c-d6104b0d012a"}",'&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2019 18:56:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-NPrinting/users-id-roles-body-parameter/m-p/1631609#M26274</guid>
      <dc:creator>davwade1</dc:creator>
      <dc:date>2019-10-04T18:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: users/{id}/roles body parameter</title>
      <link>https://community.qlik.com/t5/Qlik-NPrinting/users-id-roles-body-parameter/m-p/1631618#M26275</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/8367"&gt;@davwade1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've put the word out to my colleagues.&lt;/P&gt;
&lt;P&gt;In the meantime, just check the role GUID again as shown in the image below:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="role GUID.PNG" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/20717i37C00E42867932FC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="role GUID.PNG" alt="role GUID.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2019 19:36:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-NPrinting/users-id-roles-body-parameter/m-p/1631618#M26275</guid>
      <dc:creator>Frank_S</dc:creator>
      <dc:date>2019-10-04T19:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: users/{id}/roles body parameter</title>
      <link>https://community.qlik.com/t5/Qlik-NPrinting/users-id-roles-body-parameter/m-p/1631638#M26281</link>
      <description>&lt;P&gt;OK. I confirmed the IDs for the role and user. They are correct.&lt;/P&gt;&lt;P&gt;I'll keep my fingers crossed that one of your colleagues has done battle with this API in the past. Thanks&lt;/P&gt;&lt;P&gt;And not to be greedy...but it looks like the API will allow multiple roles to be passed in during one call (because the API Reference mentions roleIDs (plural)). So it would also be great to get the syntax for passing multiple roles as I will definitely need to do that.&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2019 20:23:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-NPrinting/users-id-roles-body-parameter/m-p/1631638#M26281</guid>
      <dc:creator>davwade1</dc:creator>
      <dc:date>2019-10-04T20:23:23Z</dc:date>
    </item>
    <item>
      <title>Re: users/{id}/roles body parameter</title>
      <link>https://community.qlik.com/t5/Qlik-NPrinting/users-id-roles-body-parameter/m-p/1631646#M26283</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/8367"&gt;@davwade1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See attached QVF from one of my colleagues.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In any case, this comes with a caveat and should be used as is...there is no guarantee of it's success in your environment ... but it may guide you to the answers you need.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;EM&gt;The QVF (attached) contains code that pulls in Users/Roles from the QS Repository and assigns appropriate roles within NPrinting. I have highlighted the tabs relevant to Role assignment.&lt;/EM&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;EM&gt;Note: I was unable to create new roles using this script. However, I was able to assign users to existing NP roles.&lt;/EM&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN&gt;Hope this helps...if not, hopefully someone else will provide a response here for you that will be helpful.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Have a good weekend...&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2019 20:55:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-NPrinting/users-id-roles-body-parameter/m-p/1631646#M26283</guid>
      <dc:creator>Frank_S</dc:creator>
      <dc:date>2019-10-04T20:55:35Z</dc:date>
    </item>
    <item>
      <title>Re: users/{id}/roles body parameter</title>
      <link>https://community.qlik.com/t5/Qlik-NPrinting/users-id-roles-body-parameter/m-p/1631654#M26284</link>
      <description>&lt;P&gt;WOOHOO!! That did it!! I had a copy of v1 of that qvf (it did not contain the role stuff).&lt;/P&gt;&lt;P&gt;Thanks so much for all your help today. I REALLY appreciate it. Have a great weekend.&lt;/P&gt;&lt;P&gt;let vRoleID = '024a9f15-70ef-45c9-a473-df4580fcdb1a,c3501700-d42a-4703-906c-d6104b0d012a,bde92144-4b8b-4382-a675-6b25afa63c54,ae214d96-1455-498d-a8da-061f159ce9ba,af6b14bb-96d9-4569-ba1f-da8eaaa10f09,ee907ad7-52ce-420c-bbd8-3b4b77df48cc,61a74a24-7ced-4318-8b0d-7571a82c3de9,feaa01d3-b6ac-422a-bd7a-f28a59149065,c511834a-2cb9-416e-b11c-d9a15303da06';&lt;/P&gt;&lt;P&gt;LET vUserRoleBody = '[""' &amp;amp; replace(vRoleID,',',chr(34) &amp;amp; chr(34)&amp;amp;','&amp;amp;chr(34) &amp;amp; chr(34)) &amp;amp; '""]' ;&lt;/P&gt;&lt;P&gt;UpdateRoles:&lt;BR /&gt;SQL SELECT&lt;BR /&gt;"__KEY_data"&lt;BR /&gt;FROM&lt;BR /&gt;JSON (wrap off) "data" PK "__KEY_data"&lt;BR /&gt;WITH CONNECTION&lt;BR /&gt;(&lt;BR /&gt;URL "$(vURL)", BODY "$(vUserRoleBody)",&lt;BR /&gt;HTTPHEADER "Origin" "$(vQlikSenseServer)",&lt;BR /&gt;HTTPHEADER "Content-Type" "application/json",&lt;BR /&gt;HTTPHEADER "X-HTTP-Method-Override" "PUT",&lt;BR /&gt;HTTPHEADER "cookie" "$(vCookie)"&lt;BR /&gt;);&lt;/P&gt;&lt;P&gt;For everyone playing along at home this is what the BODY part of the call looked like:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;BODY "[""024a9f15-70ef-45c9-a473-df4580fcdb1a"",""c3501700-d42a-4703-906c-d6104b0d012a"",""bde92144-4b8b-4382-a675-6b25afa63c54"",""ae214d96-1455-498d-a8da-061f159ce9ba"",""af6b14bb-96d9-4569-ba1f-da8eaaa10f09"",""ee907ad7-52ce-420c-bbd8-3b4b77df48cc"",""61a74a24-7ced-4318-8b0d-7571a82c3de9"",""feaa01d3-b6ac-422a-bd7a-f28a59149065"",""c511834a-2cb9-416e-b11c-d9a15303da06""]" ,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2019 21:16:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-NPrinting/users-id-roles-body-parameter/m-p/1631654#M26284</guid>
      <dc:creator>davwade1</dc:creator>
      <dc:date>2019-10-04T21:16:59Z</dc:date>
    </item>
  </channel>
</rss>

