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.
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.
Please help us get the Status and Completed data from the NPrinting API.
LIB CONNECT TO 'NPrinting REST_POST';
let vPublshTaskURL = 'https://host/api/v1/tasks/'&'$(vTaskId)'&'/executions';
FROM JSON (wrap off) "data" PK "__KEY_data"
WITH CONNECTION( URL "$(vPublshTaskURL)", HTTPHEADER "cookie" "$(vCookie)");
LOAD [__KEY_data] AS [__KEY_data]
WHERE NOT IsNull([__KEY_data]);
DROP TABLE RestNPTaskTriggerTable;
I followed the article and stuck on first point:
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
FROM JSON "_response_header" PK "__KEY__response_header";
LOAD [Set-Cookie] AS [Set-Cookie]
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
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.
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.