Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Apr 19, 2022 7:54:07 AM
Jul 14, 2021 10:21:47 AM
This tutorial contains an example of how to run a Qlik NPrinting API call with POST method from a QlikView script.
If you are interested in running Qlik NPrinting API calls from a Qlik Sense script refer to How to use Qlik NPrinting APIs inside a Qlik Sense load script. The Qlik REST connector is the same for both QlikView and Qlik Sense so there are small differences in using it in the two environments.
The Qlik REST Connector need to be installed in QlikView. You can refer to the official instruction at REST Connector.
let vNPrintingServer = 'https://YourServerAddress:4993';
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]);
Let vCookieRaw = Peek('Set-Cookie',0,'cookie_items');
Let vCookie = TextBetween(vCookieRaw,'SameSite=None,',' Path=/',SubStringCount(vCookieRaw,'SameSite=None')-1);
DROP TABLE RestConnectorMasterTable;
let vReloadMetadataURL= vNPrintingServer & '/api/v1/connections/YourConnectionID/reload';
RestNPReloadMetadataTable:
SQL SELECT
"__KEY_data"
FROM JSON (wrap off) "data" PK "__KEY_data"
WITH CONNECTION( URL "$(vReloadMetadataURL)", HTTPHEADER "cookie" "$(vCookie)");
[metadata_items]:
LOAD [__KEY_data] AS [__KEY_data]
RESIDENT RestNPReloadMetadataTable
WHERE NOT IsNull([__KEY_data]);
DROP TABLE RestNPReloadMetadataTable;