Qlik Community

Qlik NPrinting Discussions

Discussion Board for collaboration on Qlik NPrinting.

Announcements
Qlik Analytics Tour 2020 Online. Begins August 10th. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor III
Contributor III

Re: How to use Qlik NPrinting APIs inside a Qlik Sense load script

Hello community,

I am trying to use the guide "How to use Qlik NPrinting APIs inside a Qlik Sense load script".

When the script to get the cookie variable "let vCookie = TextBetween('$(vCookieRaw)','Secure,','Path=/',2);"

the variable is empty.

I am using Qlik Sense February 2019 SR 1.

Can you explain what where I can find the cookie information inside the Set-Cookie field.

Thank you,

Francesco

Highlighted
Support
Support

Re: How to use Qlik NPrinting APIs inside a Qlik Sense load script

Hi 

Unfortunately there is a bug with the Qlik Sense Rest connector that comes with Qlik Sense Feb. 2019 that is causing NP API issues.

For updates, please see the following article which will contain updates as they are received from R&D.

Sincerest apologies for the inconvenience while our R&D team works to resolve the issue.

The workaround suggestion is also in the article below.

https://support.qlik.com/articles/000059611

We are just 'like' you & like to be liked when we provide a helpful answer and or when you press the 'Solution Accepted' button if an answer provided resolves your question or issue... Cheers!
Highlighted
Contributor
Contributor

Re: How to use Qlik NPrinting APIs inside a Qlik Sense load script

Hi ,

Please help us get the Status and Completed data from the NPrinting API. 

REST API : https://host/api/v1/tasks/taskid/executions

1.JPG

QLik Script:

LIB CONNECT TO 'NPrinting REST_POST';


let vPublshTaskURL = 'https://host/api/v1/tasks/'&'$(vTaskId)'&'/executions';

RestNPTaskTriggerTable:
SQL SELECT
"__KEY_data"
FROM JSON (wrap off) "data" PK "__KEY_data"
WITH CONNECTION( URL "$(vPublshTaskURL)", HTTPHEADER "cookie" "$(vCookie)");

[_post_items]:
LOAD [__KEY_data] AS [__KEY_data]
RESIDENT RestNPTaskTriggerTable
WHERE NOT IsNull([__KEY_data]);
DROP TABLE RestNPTaskTriggerTable;

Highlighted
Specialist III
Specialist III

Re: How to use Qlik NPrinting APIs inside a Qlik Sense load script

Hi ,

I followed the article and stuck on first point:

 

NP Login
This section contains the instructions needed to perform an NPinting NTLM login in order to obtain the Session Cookie that we are going to use in all the subsequent calls:
//Connect to NPrinting using the GET REST Connection
LIB CONNECT TO 'NPrinting REST Login (qtsel_gpr)';
//Perform a GET call to NPrinting NTLM login API
RestConnectorMasterTable:
SQL SELECT
"Set-Cookie",
"__KEY__response_header"
FROM JSON "_response_header" PK "__KEY__response_header";
[_response_header]:
LOAD [Set-Cookie] AS [Set-Cookie]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__KEY__response_header]);

 

//Extracts session cookie from the API response
let vCookieRaw = Peek('Set-Cookie',0,'_response_header');
let vCookie = TextBetween('$(vCookieRaw)','Secure,','Path=/',2);

 

My user is administrator in NP and root admin in Qlik Sense and same is service user. I added Qlik Sense URL in NP API trusted host.

The value im vCookieRaw  is

"

NPWEBCONSOLE_SESSION=ce9061882ebdd7f0c47dee41359ddc26bcea4532-%00_TS%3Asession%00%00NPWEBCONSOLE_XSRF-TOKEN%3AlAutI%2FIthh1aa0M%2BgIManj5kuK%2FbIHIfULNPeGiBQM4%3D%00; Path=/; HttpOnly; Secure,NPWEBCONSOLE_SESSION=14b848c65f15fc053fdd50a4dcf787b7a5b45c99-%00NPWEBCONSOLE_XSRF-TOKEN%3AlAutI%2FIthh1aa0M%2BgIManj5kuK%2FbIHIfULNPeGiBQM4%3D%00%00_TS%3Asession%00%00userid%3A1e081ad762cf40d78ba959e8652504d6%00%00userlogin%3A2019-06-24T16%3A38%3A18.3479699Z%00; Path=/; HttpOnly; Secure

"

by which null is getting calculated in vCookie .

 

 

Can you please help me to fix it so I can move forward ?

 

Thanks in advance

Rohit

Highlighted
Employee
Employee

Re: How to use Qlik NPrinting APIs inside a Qlik Sense load script

There are a couple of versions of the REST Connector that don't set the cookie correctly.  The only solution is to upgrade Qlik Sense and the upgrade will update the REST Connector.  Which version of Qlik Sense are you on ?  Qlik Sense April 2019+ works great but not Qlik Sense Feb 2019. Qlik Sense Nov 2018 also worked.  

Highlighted
Specialist III
Specialist III

Re: How to use Qlik NPrinting APIs inside a Qlik Sense load script

unfortunately, I am using Qlik Sense Feb 2019 and NP Feb 2019 SR1.

 

Thanks,

Rohit 

Highlighted
Employee
Employee

Re: How to use Qlik NPrinting APIs inside a Qlik Sense load script

You wouldn't have to upgrade NPrinting, but upgrading Qlik Sense would be required to get the fix. 

There is also supposed to be an Qlik Sense February 2019 SR3 coming out in a few weeks. You could wait and check the release notes to see if it will be fixed there too. 

Highlighted
Specialist III
Specialist III

Re: How to use Qlik NPrinting APIs inside a Qlik Sense load script

Thanks Jonny  for your help.

 

 

Highlighted
Employee
Employee

Re: How to use Qlik NPrinting APIs inside a Qlik Sense load script

Yup its fixed in Feb 2019 Qlik Sense, but you need Feb 2019 Qlik Sense SR4 to be exact.  

Jira issue ID: QVXREST-837