<?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: Qlik NPrinting API's inside Qlik Sense load script, Extracting Session cookie in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Qlik-NPrinting-API-s-inside-Qlik-Sense-load-script-Extracting/m-p/2520798#M106458</link>
    <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/58383"&gt;@David_Friend&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did some more research and came across an article&amp;nbsp;&lt;A href="https://community.qlik.com/t5/Official-Support-Articles/How-to-use-NPrinting-APIs-with-Qlik-REST-Connector/ta-p/1717126" target="_blank" rel="noopener"&gt;How to use NPrinting APIs with Qlik REST Connector - Qlik Community - 1717126&lt;/A&gt;. This gave enough information to work with. I managed to figure out that Nprinting has changed the way it manages session cookies. I had to replace the line of code&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;let vCookie = TextBetween('$(vCookieRaw)','Secure;','Path=/',2);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;with the following line of code to make things work&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Let vCookie = SubField('$(vCookieRaw)',',',4); The session cookie that I extracted looks something like this&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"NPWEBCONSOLE_SESSION=733bed0dea75f6a1c9c816b583b8d8fe51baebb8-%00NPWEBCONSOLE_XSRF-TOKEN%3AdYp3GrNFhWQNk2tTxt362YK02zkAtJL2UfCVm1w5C%2BI%3D%00%00_TS%3Asession%00%00userid%3A4368b68a2ed54443bf0c7b85a76b3d4f%00%00userlogin%3A2025-06-11T03%3A43%3A43.6158566Z%00; Path=/; HttpOnly; Secure; SameSite=None"&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;You have to split the raw cookie on the comma it appears with the later versions of nprinting.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 11 Jun 2025 04:16:54 GMT</pubDate>
    <dc:creator>michasiuk</dc:creator>
    <dc:date>2025-06-11T04:16:54Z</dc:date>
    <item>
      <title>Qlik NPrinting API's inside Qlik Sense load script, Extracting Session cookie</title>
      <link>https://community.qlik.com/t5/App-Development/Qlik-NPrinting-API-s-inside-Qlik-Sense-load-script-Extracting/m-p/2519085#M106177</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/29458"&gt;@Marc&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been following a document Publish by Qlik about how to use Qlik Nprinting API's inside a load script. Se attached.&amp;nbsp; I have successfully managed to set up the rest connections and managed to get the code on Page 12 of the document to work properly as shown below.&lt;/P&gt;&lt;P&gt;//Connect to NPrinting using the GET REST Connection&lt;BR /&gt;LIB CONNECT TO 'NPrinting REST Login (qtsel_gpr)';&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;//Perform a GET call to NPrinting NTLM login API&lt;BR /&gt;RestConnectorMasterTable:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SQL SELECT&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"Set-Cookie",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"__KEY__response_header"&lt;BR /&gt;FROM JSON "_response_header" PK "__KEY__response_header";&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;[_response_header]:&lt;BR /&gt;LOAD [Set-Cookie] AS [Set-Cookie]&lt;BR /&gt;RESIDENT RestConnectorMasterTable&lt;BR /&gt;WHERE NOT IsNull([__KEY__response_header]);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;//Extracts session cookie from the API response&lt;BR /&gt;let vCookieRaw = Peek('Set-Cookie',0,'_response_header');&lt;BR /&gt;let vCookie = TextBetween('$(vCookieRaw)','Secure,','Path=/',2);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;DROP TABLE RestConnectorMasterTable;&lt;/P&gt;&lt;P&gt;When the code runs it manages to get the RAW cookie data and store it in the variable&amp;nbsp;vCookieRaw but it's not successfully extracting the session cookie data in the variable&amp;nbsp;vCookie. The contents of the variable&amp;nbsp;vCookieRaw I have listed below. I need to adjust some how the delimiters in the text between function to extract the session cookie. So I need figure out how to identify the session cookie in the raw cookie data so I can extract it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;'NPWEBCONSOLE_XSRF-TOKEN=2bUxAp2KHUi4J74pAZ3IuAnq8pApPqEQFrUkfCgVySE=; Path=/; Secure; SameSite=None,NPWEBCONSOLE_SESSION=fed51ec0a77ead9fd0f78fe4ca77124e0a2380a0-%00NPWEBCONSOLE_XSRF-TOKEN%3A2bUxAp2KHUi4J74pAZ3IuAnq8pApPqEQFrUkfCgVySE%3D%00%00_TS%3Asession%00; Path=/; HttpOnly; Secure; SameSite=None,NPWEBCONSOLE_XSRF-TOKEN=2HrcIdHCYx3Bib/sJV/GcWifpT0TspCbSacMtfuUUa0=; Path=/; Secure; SameSite=None,NPWEBCONSOLE_SESSION=6dd480d385aa1695a7cbbf87f20554958a4d429f-%00NPWEBCONSOLE_XSRF-TOKEN%3A2HrcIdHCYx3Bib%2FsJV%2FGcWifpT0TspCbSacMtfuUUa0%3D%00%00_TS%3Asession%00%00userid%3A4368b68a2ed54443bf0c7b85a76b3d4f%00%00userlogin%3A2025-05-26T07%3A12%3A19.3449016Z%00; Path=/; HttpOnly; Secure; SameSite=None'&lt;/P&gt;</description>
      <pubDate>Tue, 27 May 2025 02:40:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Qlik-NPrinting-API-s-inside-Qlik-Sense-load-script-Extracting/m-p/2519085#M106177</guid>
      <dc:creator>michasiuk</dc:creator>
      <dc:date>2025-05-27T02:40:16Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik NPrinting API's inside Qlik Sense load script, Extracting Session cookie</title>
      <link>https://community.qlik.com/t5/App-Development/Qlik-NPrinting-API-s-inside-Qlik-Sense-load-script-Extracting/m-p/2519236#M106213</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/42326"&gt;@michasiuk&lt;/a&gt;&amp;nbsp;have you looked at this post:&lt;BR /&gt;&lt;A href="https://community.qlik.com/t5/Qlik-NPrinting/NPrinting-Task-Execution-call-using-Rest-API-throwing-403/td-p/1688334" target="_blank"&gt;https://community.qlik.com/t5/Qlik-NPrinting/NPrinting-Task-Execution-call-using-Rest-API-throwing-403/td-p/1688334&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Looks like Lech answered this question possibly.&lt;/P&gt;</description>
      <pubDate>Tue, 27 May 2025 17:56:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Qlik-NPrinting-API-s-inside-Qlik-Sense-load-script-Extracting/m-p/2519236#M106213</guid>
      <dc:creator>David_Friend</dc:creator>
      <dc:date>2025-05-27T17:56:40Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik NPrinting API's inside Qlik Sense load script, Extracting Session cookie</title>
      <link>https://community.qlik.com/t5/App-Development/Qlik-NPrinting-API-s-inside-Qlik-Sense-load-script-Extracting/m-p/2519398#M106254</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/58383"&gt;@David_Friend&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had a look at the solution, but unfortunate it doesn't appear to be working for me. I did replace the comma(,) with a semi colon(;) and I managed to extract a session cookie out of the information this time but&amp;nbsp;it doesn't appear to be the correct session cookie. I tried adjusting the last parameter in the test between function but I don't seem to be able to find the correct session cookie&lt;/P&gt;&lt;P&gt;let vCookie = TextBetween('NPWEBCONSOLE_XSRF-TOKEN=6hbt1My1sj72pnx6On/IFJLbVy2m1nc2qLEa3IClcL8=; Path=/; Secure; SameSite=None,NPWEBCONSOLE_SESSION=94be81b308c3bfc2f500d00cfb77d3ebb7da3ace-%00NPWEBCONSOLE_XSRF-TOKEN%3A6hbt1My1sj72pnx6On%2FIFJLbVy2m1nc2qLEa3IClcL8%3D%00%00_TS%3Asession%00; Path=/; HttpOnly; Secure; SameSite=None,NPWEBCONSOLE_XSRF-TOKEN=IoUMvOtN19/PKLBxtRJ2m/VOr9w3JA1KHNRjilsQcxo=; Path=/; Secure; SameSite=None,NPWEBCONSOLE_SESSION=e045c91f8d03ec3090174dd230ac87020c630396-%00NPWEBCONSOLE_XSRF-TOKEN%3AIoUMvOtN19%2FPKLBxtRJ2m%2FVOr9w3JA1KHNRjilsQcxo%3D%00%00_TS%3Asession%00%00userid%3A4368b68a2ed54443bf0c7b85a76b3d4f%00%00userlogin%3A2025-05-28T04%3A39%3A04.8790075Z%00; Path=/; HttpOnly; Secure; SameSite=None','Secure;','Path=/',2)&lt;/P&gt;&lt;P&gt;RestUserMasterTable:&lt;BR /&gt;SQL SELECT&lt;BR /&gt;"__KEY_data",&lt;BR /&gt;(SELECT&lt;BR /&gt;"id",&lt;BR /&gt;"email",&lt;BR /&gt;"__FK_items"&lt;BR /&gt;FROM "items" FK "__FK_items")&lt;BR /&gt;FROM JSON (wrap off) "data" PK "__KEY_data"&lt;BR /&gt;WITH CONNECTION( URL "&lt;A href="https://Nprinting.Server:4993/api/v1/users" target="_blank"&gt;https://Nprinting.Server:4993/api/v1/users&lt;/A&gt;", HTTPHEADER "cookie" " SameSite=None,NPWEBCONSOLE_XSRF-TOKEN=IoUMvOtN19/PKLBxtRJ2m/VOr9w3JA1KHNRjilsQcxo=; " )&lt;/P&gt;&lt;P&gt;14:39:06&lt;BR /&gt;Connected&lt;BR /&gt;14:39:07&lt;BR /&gt;RestConnectorMasterTable &amp;lt;&amp;lt; RestConnectorMasterTable&lt;BR /&gt;Lines fetched: 1&lt;BR /&gt;14:39:15&lt;BR /&gt;_response_header &amp;lt;&amp;lt; RestConnectorMasterTable&lt;BR /&gt;Lines fetched: 1&lt;BR /&gt;14:52:45&lt;BR /&gt;RestUserMasterTable &amp;lt;&amp;lt; RestConnectorMasterTable&lt;BR /&gt;Script error: HTTP protocol error 403 (Forbidden):&lt;/P&gt;&lt;P&gt;The server refused to fulfill the request.&lt;BR /&gt;The following error occurred:&lt;BR /&gt;HTTP protocol error 403 (Forbidden):&lt;/P&gt;&lt;P&gt;The server refused to fulfill the request.&lt;BR /&gt;The error occurred here:&lt;BR /&gt;RestUserMasterTable:&lt;BR /&gt;SQL SELECT&lt;BR /&gt;"__KEY_data",&lt;BR /&gt;(SELECT&lt;BR /&gt;"id",&lt;BR /&gt;"email",&lt;BR /&gt;"__FK_items"&lt;BR /&gt;FROM "items" FK "__FK_items")&lt;BR /&gt;FROM JSON (wrap off) "data" PK "__KEY_data"&lt;BR /&gt;WITH CONNECTION( URL "&lt;A href="https://Nprinting.Server:4993/api/v1/users" target="_blank"&gt;https://Nprinting.Server:4993/api/v1/users&lt;/A&gt;", HTTPHEADER "cookie" " SameSite=None,NPWEBCONSOLE_XSRF-TOKEN=IoUMvOtN19/PKLBxtRJ2m/VOr9w3JA1KHNRjilsQcxo=; " )&lt;/P&gt;</description>
      <pubDate>Wed, 28 May 2025 23:38:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Qlik-NPrinting-API-s-inside-Qlik-Sense-load-script-Extracting/m-p/2519398#M106254</guid>
      <dc:creator>michasiuk</dc:creator>
      <dc:date>2025-05-28T23:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik NPrinting API's inside Qlik Sense load script, Extracting Session cookie</title>
      <link>https://community.qlik.com/t5/App-Development/Qlik-NPrinting-API-s-inside-Qlik-Sense-load-script-Extracting/m-p/2520798#M106458</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/58383"&gt;@David_Friend&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did some more research and came across an article&amp;nbsp;&lt;A href="https://community.qlik.com/t5/Official-Support-Articles/How-to-use-NPrinting-APIs-with-Qlik-REST-Connector/ta-p/1717126" target="_blank" rel="noopener"&gt;How to use NPrinting APIs with Qlik REST Connector - Qlik Community - 1717126&lt;/A&gt;. This gave enough information to work with. I managed to figure out that Nprinting has changed the way it manages session cookies. I had to replace the line of code&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;let vCookie = TextBetween('$(vCookieRaw)','Secure;','Path=/',2);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;with the following line of code to make things work&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Let vCookie = SubField('$(vCookieRaw)',',',4); The session cookie that I extracted looks something like this&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"NPWEBCONSOLE_SESSION=733bed0dea75f6a1c9c816b583b8d8fe51baebb8-%00NPWEBCONSOLE_XSRF-TOKEN%3AdYp3GrNFhWQNk2tTxt362YK02zkAtJL2UfCVm1w5C%2BI%3D%00%00_TS%3Asession%00%00userid%3A4368b68a2ed54443bf0c7b85a76b3d4f%00%00userlogin%3A2025-06-11T03%3A43%3A43.6158566Z%00; Path=/; HttpOnly; Secure; SameSite=None"&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;You have to split the raw cookie on the comma it appears with the later versions of nprinting.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jun 2025 04:16:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Qlik-NPrinting-API-s-inside-Qlik-Sense-load-script-Extracting/m-p/2520798#M106458</guid>
      <dc:creator>michasiuk</dc:creator>
      <dc:date>2025-06-11T04:16:54Z</dc:date>
    </item>
  </channel>
</rss>

