Qlik Community

Qlik NPrinting Discussions

Discussion Board for collaboration on Qlik NPrinting.

Announcements
Save $300 - Register for QlikWorld (formerly Qonnections) by January 31st: Learn More
dfoster9
Valued Contributor

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

@Daniel Jenkins Can you publish a working qlikview example?

steverosebrook
New Contributor III

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

Is there a Word document that exists with all this code in it?  Either that or a QVF that could be shared?  I'd like to try this out, but I can't copy and paste the load script code from the pdf.

Thanks,

Steve

Highlighted
Employee
Employee

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

i've posted QV and QS samples here  Distribute NPrinting reports after reloading a Qlik App

Partner
Partner

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

Otherwise below error comes
Error: QVX_UNEXPECTED_END_OF_DATA: Response headers are denied by the current connection. Please edit your connection in order to enable response headers loading.

This tip missed in pages 8/9
Partner
Partner

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

Hi,

I was able to trigger task in Nprinting through Qliksense API as per this post.Butfrom today I am getting an error which I don't have any clue.If anyone faced this type of issue please help me on this.Please find below error msg and attached log.

Error.pngError message

Partner
Partner

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

This is authentication error.Make sure that you put domain,username and pwd correctly.Sometimes qliksense domain name is different from windows domain.

Support
Support

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

Check the following support article.

NPrinting API Error: QVX_UNEXPECTED_END_OF_DATA: HTTP protocol error 500 (Internal Server Error)

https://qliksupport.force.com/articles/000057354

You need to log into the support site to down load relevant attachments.

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!
Partner
Partner

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

Thanks!! It helps to solve my problem.
Partner
Partner

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

Solution below-
NPrinting API Error: QVX_UNEXPECTED_END_OF_DATA: HTTP protocol error 500 (Internal Server Error):

Description
What are you attempting to do?
When attempting to trigger NPrinting Tasks using the NPrinting API Task Trigger from a reloaded QlikView application the QVX-UNEXPECTED-END-OF-DATA-HTTP-protocol-error-500-Internal-Server-Error error is generated
What is the expected result?
If a publish task is disabled, the API should be able to manage disabled published tasks

APP TASK
PROD Publish Task 1
PROD Publish Task 2

What is the actual result?
If any of the NPrinting Publish Tasks are initially enabled as above but then subsequently disabled or deleted, the following reload error occurs:
QVX_UNEXPECTED_END_OF_DATA: HTTP protocol error 500 (Internal Server Error)
Cause
Cause:
The current NP TASK API, is unable to manage disabled NPrinting Publish Tasks that were previously enabled.
If any Publish Task is disabled that was previously enabled, the error QVX-UNEXPECTED-END-OF-DATA-HTTP-protocol-error-500-Internal-Server-Error will be generated when reloading your application.

An improvement has been submitted that is expected to:
prevent any disabled tasks in the app from causing the reload error 'QVX_UNEXPECTED_END_OF_DATA: HTTP protocol error 500 (Internal Server Error)"
Resolution
Solution : Multiple Publish Tasks within a Single NP 'App'
Keep all Publish Tasks enabled within the NP App as in the example above. Do not disable or delete any of the Publish Tasks.
NOTE: If you must disable a publish task, you can simply disable the report or remove the report and recipients from the task but do not disable the task itself.

NOTE: that processing of more than a single tasks not a bug but rather a problem with code used to execute tasks
The API is expected to be updated in a future release of NPrinting to better manage previously enabled but then subsequently disabled tasks in an NP 'App'
At the moment, we cannot provide an estimate at this time when the update will be included in the NPrinting API library as the scope of work and implementation of the improvement is currently underway by our R&D team. The workaround is to keep all tasks enabled or follow the note in solution 2 if a report in a task must no longer go out.
In order to allow multiple tasks to run, update your load script with the appropriate code available in the QVW load script attached to this article.

UPDATE: New code has been provided by R&D that is attached to this article.This code will allow you to execute all publish tasks in within a single NPrinting App.
Caveate: You must have at least 1 publish task enabled.

Conclusion: There is no bug with the API. If you get the error QVX_UNEXPECTED_END_OF_DATA: HTTP protocol error 500 (Internal Server Error)" this is a warning that there is a problem with the code you are using in conjunction with the NPrinting Task Execution API. Use the attached code which includes the NPrinting Task Execution API to resolve the error.
Disclaimer
Access to this article is provided to you as part of your subscription to Qlik Maintenance. This article is deemed to be “Documentation” under the terms of the license agreement applicable to your Qlik software. All rights reserved © QlikTech International AB.
Partner
Partner

How to create a table which will contain all Nprinting task details along with execution status

Hello Experts,

From the above post I am able to trigger Nprinting task through Qliksense API.Now I am trying to create a dashboard to show all the task details along with execution status of the task whether running or completed or enqueue. I got a metadata table from which I can fetch all the task details time of creation,last execution etc but unable to get execution status.The below code will fetch all the task details.

Is there any other metadata table from where I can get execution status of all task? I can fetch individually execution status of a task but need the entire list.

LIB CONNECT TO  $(vAPIConnectionNameForGET);
//exit script;

let vEndpoint=  vNPrintingServer  & '/api/v1/tasks' ;

    RestConnectorMasterTable:
    SQL SELECT 
        "__KEY_data",
        (SELECT 
            "id",
            "name",
            "description",
            "type",
            "created",
            "lastUpdate",
            "lastExecution",
            "enabled",
            "appId",
            "__FK_items"
        FROM "items" FK "__FK_items")
    FROM JSON (wrap off) "data" PK "__KEY_data"
    with Connection (URL "$(vEndpoint)", HTTPHEADER "Cookie" "$(vCookie)");

    [items]:
    LOAD	[id] AS [id],
        [name] AS [name],
        [description] AS [description],
        [type] AS [type],
        [created] AS [created],
        [lastUpdate] AS [lastUpdate],
        [lastExecution] AS [lastExecution],
        [enabled] AS [enabled],
        [appId] AS [appId]
    RESIDENT RestConnectorMasterTable
    //WHERE NOT IsNull([__FK_items]) and [name]= $(vNPrintingPublishTaskName);
    WHERE NOT IsNull([__FK_items]); // and [id]= '$(vNPrintingPublishTaskID)';