<?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 Nprinting on demand API with JQuery in Qlik NPrinting</title>
    <link>https://community.qlik.com/t5/Qlik-NPrinting/Nprinting-on-demand-API-with-JQuery/m-p/139219#M4910</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, I am trying to write some simple code to launch a report with a specified id.&lt;/P&gt;&lt;P&gt;According to the documentation i tried to get the on demand request for the given id as follow:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;$.ajax({&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* start login (this section works fine)*/&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;type: 'GET',&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;url: $('#NprintingServerURL').val()+'/api/v1/login/ntlm',&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;dataType: "json",&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;xhrFields: {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; withCredentials: true&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;},&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;crossDomain: true,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;contentType :&amp;nbsp; 'application/json',&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;success: function(data) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(data); &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;},&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;error: function() {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert('Error in login');&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;} &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;/* end login (this section works fine)*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;}).done(function(data){&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var pData= {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;type: 'report',&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;config: {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; reportId: repId,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; outputFormat: 'PDF'&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;}};&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;var idata=JSON.stringify(pData);&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $.ajax({&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;type: 'POST',&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;url: $('#NprintingServerURL').val()+'/api/v1/ondemand/requests',&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;data: idata,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;xhrFields: {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;withCredentials: true&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;} ,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;crossDomain: true,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;contentType:&amp;nbsp; 'application/json',&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;success: function(data) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;console.log(data);&amp;nbsp; //always get an error as explained dbelow&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;},&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;error: function(data) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;alert('Error in ondemand request');&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;console.log(data); &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;}&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;})&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;But i always get an error in ondemand request, here the response text:&lt;/P&gt;&lt;P&gt;"&amp;lt;!DOCTYPE html&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;html lang="en"&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;head&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;title&amp;gt;Forbidden&amp;lt;/title&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/head&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;body&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;h1&amp;gt;&lt;/P&gt;&lt;P&gt;Forbidden&lt;/P&gt;&lt;P&gt;&amp;lt;/h1&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;p&amp;gt;&lt;/P&gt;&lt;P&gt;REVEL_CSRF: tokens mismatch.&lt;/P&gt;&lt;P&gt;&amp;lt;/p&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/body&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/html&amp;gt;&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;I checked the single calls with postman and they worked.&lt;/P&gt;&lt;P&gt;I saw the Phyton sample, but i can't replicate it in JQuery.&lt;/P&gt;&lt;P&gt;I think i miss to set the header X-XSRF-TOKEN but i don't have any idea how to get the cookie values in JQuery and how to set in my code the X-XSRF-TOKEN value. &lt;/P&gt;&lt;P&gt;I have tried in several ways without success and it's driving me crazy, please help me.&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;Marcello !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 Jul 2018 10:08:19 GMT</pubDate>
    <dc:creator>marcello</dc:creator>
    <dc:date>2018-07-30T10:08:19Z</dc:date>
    <item>
      <title>Nprinting on demand API with JQuery</title>
      <link>https://community.qlik.com/t5/Qlik-NPrinting/Nprinting-on-demand-API-with-JQuery/m-p/139219#M4910</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, I am trying to write some simple code to launch a report with a specified id.&lt;/P&gt;&lt;P&gt;According to the documentation i tried to get the on demand request for the given id as follow:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;$.ajax({&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* start login (this section works fine)*/&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;type: 'GET',&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;url: $('#NprintingServerURL').val()+'/api/v1/login/ntlm',&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;dataType: "json",&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;xhrFields: {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; withCredentials: true&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;},&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;crossDomain: true,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;contentType :&amp;nbsp; 'application/json',&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;success: function(data) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(data); &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;},&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;error: function() {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert('Error in login');&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;} &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;/* end login (this section works fine)*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;}).done(function(data){&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var pData= {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;type: 'report',&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;config: {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; reportId: repId,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; outputFormat: 'PDF'&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;}};&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;var idata=JSON.stringify(pData);&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $.ajax({&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;type: 'POST',&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;url: $('#NprintingServerURL').val()+'/api/v1/ondemand/requests',&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;data: idata,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;xhrFields: {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;withCredentials: true&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;} ,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;crossDomain: true,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;contentType:&amp;nbsp; 'application/json',&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;success: function(data) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;console.log(data);&amp;nbsp; //always get an error as explained dbelow&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;},&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;error: function(data) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;alert('Error in ondemand request');&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;console.log(data); &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;}&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;})&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;But i always get an error in ondemand request, here the response text:&lt;/P&gt;&lt;P&gt;"&amp;lt;!DOCTYPE html&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;html lang="en"&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;head&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;title&amp;gt;Forbidden&amp;lt;/title&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/head&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;body&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;h1&amp;gt;&lt;/P&gt;&lt;P&gt;Forbidden&lt;/P&gt;&lt;P&gt;&amp;lt;/h1&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;p&amp;gt;&lt;/P&gt;&lt;P&gt;REVEL_CSRF: tokens mismatch.&lt;/P&gt;&lt;P&gt;&amp;lt;/p&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/body&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/html&amp;gt;&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;I checked the single calls with postman and they worked.&lt;/P&gt;&lt;P&gt;I saw the Phyton sample, but i can't replicate it in JQuery.&lt;/P&gt;&lt;P&gt;I think i miss to set the header X-XSRF-TOKEN but i don't have any idea how to get the cookie values in JQuery and how to set in my code the X-XSRF-TOKEN value. &lt;/P&gt;&lt;P&gt;I have tried in several ways without success and it's driving me crazy, please help me.&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;Marcello !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jul 2018 10:08:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-NPrinting/Nprinting-on-demand-API-with-JQuery/m-p/139219#M4910</guid>
      <dc:creator>marcello</dc:creator>
      <dc:date>2018-07-30T10:08:19Z</dc:date>
    </item>
    <item>
      <title>Re: Nprinting on demand API with JQuery</title>
      <link>https://community.qlik.com/t5/Qlik-NPrinting/Nprinting-on-demand-API-with-JQuery/m-p/139220#M4911</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I asked the help of a developer who suggested to set cookies and &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt; X-XSRF-TOKEN &lt;/SPAN&gt;token in the header to the post call as visible in the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;function getXSRFToken () {&lt;/P&gt;&lt;P&gt;var cookies = document.cookie.split( ';' ),&lt;/P&gt;&lt;P&gt;token = '';&lt;/P&gt;&lt;P&gt;cookies.forEach( function ( cookie ) {&lt;/P&gt;&lt;P&gt;var index = cookie.indexOf( '=' ),&lt;/P&gt;&lt;P&gt;key = cookie.substring( 0, index ),&lt;/P&gt;&lt;P&gt;val = cookie.substring( index + 1 );&lt;/P&gt;&lt;P&gt;if ( key.trim().toUpperCase() === 'NPWEBCONSOLE_XSRF-TOKEN' ) {&lt;/P&gt;&lt;P&gt;token = val;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;} );&lt;/P&gt;&lt;P&gt;return token;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;function getHeaders () {&lt;/P&gt;&lt;P&gt;var objHeaders = {&lt;/P&gt;&lt;P&gt;'Accept': 'application/json'&lt;/P&gt;&lt;P&gt;},&lt;/P&gt;&lt;P&gt;csrf = getXSRFToken();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if ( csrf.length ) {&lt;/P&gt;&lt;P&gt;objHeaders = $.extend( objHeaders, {&lt;/P&gt;&lt;P&gt;'X-XSRF-TOKEN': csrf&lt;/P&gt;&lt;P&gt;} );&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;return objHeaders;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;function callback () {&lt;/P&gt;&lt;P&gt;var pData = {&lt;/P&gt;&lt;P&gt;type: 'report',&lt;/P&gt;&lt;P&gt;config: {&lt;/P&gt;&lt;P&gt;reportId: repId,&lt;/P&gt;&lt;P&gt;outputFormat: 'PDF'&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;};&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var idata = JSON.stringify( pData ),&lt;/P&gt;&lt;P&gt;headers = getHeaders();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$.ajax( {&lt;/P&gt;&lt;P&gt;method: 'POST',&lt;/P&gt;&lt;P&gt;url: $( '#NprintingServerURL' ).val() + '/api/v1/ondemand/requests',&lt;/P&gt;&lt;P&gt;data: idata,&lt;/P&gt;&lt;P&gt;xhrFields: {&lt;/P&gt;&lt;P&gt;withCredentials: true&lt;/P&gt;&lt;P&gt;},&lt;/P&gt;&lt;P&gt;crossDomain: true,&lt;/P&gt;&lt;P&gt;headers: headers,&lt;/P&gt;&lt;P&gt;dataType: 'json',&lt;/P&gt;&lt;P&gt;contentType: 'application/json; charset=utf-8',&lt;/P&gt;&lt;P&gt;success: function ( result ) {&lt;/P&gt;&lt;P&gt;console.log( result );&lt;/P&gt;&lt;P&gt;},&lt;/P&gt;&lt;P&gt;error: function ( error ) {&lt;/P&gt;&lt;P&gt;alert( 'Error in ondemand request' );&lt;/P&gt;&lt;P&gt;console.log( error );&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;} );&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Ruggero&lt;/P&gt;&lt;P&gt;---------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;When applicable please mark the appropriate replies as CORRECT &lt;/SPAN&gt;&lt;A class="jive-link-wiki-small" data-containerid="2001" data-containertype="14" data-objectid="14806" data-objecttype="102" href="https://community.qlik.com/docs/DOC-14806"&gt;https://community.qlik.com/docs/DOC-14806&lt;/A&gt;&lt;SPAN&gt;. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads as HELPFUL if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as HELPFUL if you feel additional info is useful to others.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2018 09:02:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-NPrinting/Nprinting-on-demand-API-with-JQuery/m-p/139220#M4911</guid>
      <dc:creator>Ruggero_Piccoli</dc:creator>
      <dc:date>2018-07-31T09:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: Nprinting on demand API with JQuery</title>
      <link>https://community.qlik.com/t5/Qlik-NPrinting/Nprinting-on-demand-API-with-JQuery/m-p/139221#M4912</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ruggero, many thanks for your accurate answer, but unforunatly it does not solve the problem.&lt;/P&gt;&lt;P&gt;The document.cookie always return an empty string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I read that it's cause the browser it's not allowed to read it.&lt;/P&gt;&lt;P&gt;So i do not know how to deal with this, according to the documentation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In other words, how can Postman do that ?&lt;/P&gt;&lt;P&gt;I mean, i've tried to reply the required steps (so i setted the proper headers value X-XSRF-TOKEN reading from cookie showed) using Postman with success, but i cannot realize how to do the same in a Javascript code.&lt;/P&gt;&lt;P&gt;I know cookies are keeped correctly but i cannot set the proper header value&amp;nbsp; X-XSRF-TOKEN without reading it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers, Marcello&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2018 12:51:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-NPrinting/Nprinting-on-demand-API-with-JQuery/m-p/139221#M4912</guid>
      <dc:creator>marcello</dc:creator>
      <dc:date>2018-07-31T12:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: Nprinting on demand API with JQuery</title>
      <link>https://community.qlik.com/t5/Qlik-NPrinting/Nprinting-on-demand-API-with-JQuery/m-p/139222#M4913</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, it could be a browser problem, that is out of our control. You should try a different solution that avoid to insert the code in the HTML page.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Postman is not a browser so I think it has different security policies.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another suggestion from the developers:&lt;/P&gt;&lt;P&gt;The response of the login call conains the header &lt;SPAN style="font-size: 13.3333px;"&gt;"Set-Cookie". You could parse that header and extract the value with the key &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;"NPWEBCONSOLE_XSRF-TOKEN".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Ruggero&lt;/P&gt;&lt;P&gt;---------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;When applicable please mark the appropriate replies as CORRECT &lt;/SPAN&gt;&lt;A class="jive-link-wiki-small" data-containerid="2001" data-containertype="14" data-objectid="14806" data-objecttype="102" href="https://community.qlik.com/docs/DOC-14806"&gt;https://community.qlik.com/docs/DOC-14806&lt;/A&gt;&lt;SPAN&gt;. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads as HELPFUL if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as HELPFUL if you feel additional info is useful to others.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Aug 2018 09:55:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-NPrinting/Nprinting-on-demand-API-with-JQuery/m-p/139222#M4913</guid>
      <dc:creator>Ruggero_Piccoli</dc:creator>
      <dc:date>2018-08-01T09:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: Nprinting on demand API with JQuery</title>
      <link>https://community.qlik.com/t5/Qlik-NPrinting/Nprinting-on-demand-API-with-JQuery/m-p/139223#M4914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, i am realizing there is no way using JQuery to achieve the result.&lt;/P&gt;&lt;P&gt;It seems there is no way to read the response header, cause browser security settings.&lt;/P&gt;&lt;P&gt;So, again, no way to get the required cookie value to set X-XSRF-TOKEN according the documentation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ruggero, you have been very kind and useful to my investigation even if i did not achieve the hoped result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So i think the definitive answer is : if you want to do that you cannot do using a jquery script in a html page.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With kind regards, Marcello&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Aug 2018 13:29:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-NPrinting/Nprinting-on-demand-API-with-JQuery/m-p/139223#M4914</guid>
      <dc:creator>marcello</dc:creator>
      <dc:date>2018-08-01T13:29:34Z</dc:date>
    </item>
  </channel>
</rss>

