Skip to main content
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT

Run a Qlik NPrinting API POST command via QlikView reload script

100% helpful (1/1)
Showing results for 
Search instead for 
Did you mean: 

Run a Qlik NPrinting API POST command via QlikView reload script

Last Update:

Apr 19, 2022 7:54:07 AM

Updated By:


Created date:

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.



Qlik NPrinting 


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.

  1. Create a trusted origin in Qlik NPrinting with the name of the computer where you will run the QlikView script:


  2. We will run a connection cache reload, so retrieve its ID by opening it in the browser and copying the last part of the URL.
  3. Create a new QlikView Document, open the load script editor and create a new REST connection:


  4. Start to fill the connection form:


    1. Insert the NTLM authentication URL post /login/ntlm
    2. Set the method to POST
    3. Select Windows NTLM as Authentication Schema
    4. Insert Username and Password
    5. Flag the Skip server certificate validation option if your Qlik NPrinting server has not a valid SSL certificate


  5. Scroll down and in the Query headers insert origin as name and the URL of the trusted origin you set few steps ago in the Qlik NPrinting Server.
  6. Check the flag Allow repornse headers.
  7. Click on Test Connection, if it works correctly click on ok. The connection string will be inserted in the QlikVew script.
  8. Insert the code to retrieve the connection cookie:
    let vNPrintingServer = 'https://YourServerAddress:4993';
    FROM JSON "_response_header" PK "__KEY__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;
  9. Insert the code to run the POST call to run the cache reload post /connections/{
    let vReloadMetadataURL=  vNPrintingServer  & '/api/v1/connections/YourConnectionID/reload';
    FROM JSON (wrap off) "data" PK "__KEY_data"
    WITH CONNECTION( URL "$(vReloadMetadataURL)", HTTPHEADER "cookie" "$(vCookie)");
    LOAD [__KEY_data] AS [__KEY_data]
    RESIDENT RestNPReloadMetadataTable
    WHERE NOT IsNull([__KEY_data]);
    DROP TABLE RestNPReloadMetadataTable;​

    For detailed explanations of the script, refer to the official REST Connector documentation.

  10. Run the reload script. Open the Task Executions page of your Qlik NPrinting server. If everything went good you will see the reload cache running.




Labels (1)
Version history
Last update:
‎2022-04-19 07:54 AM
Updated by: