Skip to main content
Announcements
Defect acknowledgement with Nprinting Engine May 2022 SR2, please READ HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
Gianluca_Perin
Employee
Employee

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

Hi all,

attached you'll find a step by step tutorial explaining how to use Qlik Sense (and also QlikView) load script to interact with the Qlik NPrinting APIs.

The examples include:

  • Logging in into NPrinting
  • Collecting data from NPrinting
  • Reloading metadata for a NPrinting connection
  • Create, update and delete NPrinting users
  • Triggering a NPrinting publish task

This document also shows how to use Qlik Sense Tasks to chain these different events directly from QMC.

This tutorial uses standard Qlik REST Connector.

Please read carefully the requirements before to dig into the actual examples.

Enjoy!

58 Replies
pokassov
Specialist
Specialist

never mind, I found the answer.

It was needed to just add a parameter

WITH CONNECTION( URL "https://nprintingserver.domain.com:4993/api/v1/apps?limit=200", HTTPHEADER "cookie" "$(vCookie)" );

Best regards,

Sergey

pokassov
Specialist
Specialist

Hi Gianluca,

Is Qlik Rest Connector 1.3 applicable to QlikView?

I successfully implemented 1.0 Build Revision: 12 with both scenarios:

1. Use Windows authentication No (provided my credentials)

2. Use Windows authentication Yes (running services account was added as an admin to NPrinting)

When I upgraded connector to version 1.3, I got an error "Connection failed. Failed to connect to server".

Is there a way to check why the new version doesn't work?

And looks like I can't use service running account either.

Regards, Sergey

pix
Partner - Contributor III
Partner - Contributor III

Hi Gianluca,

Thank you for this post, it is awesome! Considering that I know nothing about APIs, I was able to filter on an app ID, get the tasks related to it and then trigger them from QMC using a QV app. The documentation is very good for newbies.

I am trying now to work with the Users part; I managed to get several details on users, but I'm stuck on retrieving the users assigned to a specific group ID.

I used the following URL: https://servername:port/api/v1/groups/groupID/users in the WITH Connection statement and I got results for all the fields except for "items" out of the below response structure (taken from the NPrinting API Reference):

{
  "data" : {
  "totalItems" : 0,
  "offset" : 6,
  "limit" : 1,
  "items" : [ "00000000-0000-0000-0000-000000000000" ]
  }
}

If I try to test the URL in a browser, I get a JSON file which contains the information I need (opened it with an excel). I think I need to work on the script, so that the items field can be read in QV, but I don't know where to start. If you have any suggestions, please let me know.

Thank you,

Diana

Anonymous
Not applicable

Hi Gianluca,

thanks a lot for sharing the idea and the documentation!

 

The GET Connector works fine in my case and successfully returned the app, connection and all tasks. However, I have some trouble with the last step (POST Task execution) with the following error message:

NP_error.png

I checked that the Server ist added to Nprintings Trusted Origins and the option „allow response headers“ is allowed.

I use:

Qlik Rest Connector 1.3.0

Qlikview Desktop 12.10 SR4

Qlikview NPrinting April 2018 (Version: 18.9.5)

Do you have a suggestion where the problem could be?

Best regards

Yang

Ruggero_Piccoli
Support
Support

Hi,


The API https://servername:port/api/v1/groups/groupID/users‌ returns the list of the guid of the users that are in the group. So, for example :

<d3p1:guid>19e5b96e-da8d-4c9b-bd19-4734dfa90c53</d3p1:guid>

<d3p1:guid>af78752a-6fe1-4bbe-bd83-88b6bf0d5380</d3p1:guid>

<d3p1:guid>ffe2a664-5698-4189-a989-bc8f16ee146f</d3p1:guid>


Than you can use the API:

https://servername:port/api/v1/users/19e5b96e-da8d-4c9b-bd19-4734dfa90c53

where I inserted the first user guid to retrieve its information.

Of course you have to do this in your script.

Best Regards,

Ruggero

---------------------------------------------

When applicable please mark the appropriate replies as CORRECT https://community.qlik.com/docs/DOC-14806. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads as HELPFUL if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as HELPFUL if you feel additional info is useful to others.



Best Regards,
Ruggero
---------------------------------------------
When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads with a LIKE if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads with LIKEs if you feel additional info is useful to others.
Ruggero_Piccoli
Support
Support

Hi,

Please open a new conversation for each question. In your case please add more details because it is not clear in what situation the problem appears.

Thanks

Best Regards,

Ruggero

---------------------------------------------

When applicable please mark the appropriate replies as CORRECT https://community.qlik.com/docs/DOC-14806. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads as HELPFUL if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as HELPFUL if you feel additional info is useful to others.



Best Regards,
Ruggero
---------------------------------------------
When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads with a LIKE if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads with LIKEs if you feel additional info is useful to others.
h_prakash
Creator II
Creator II

Thank you all for your inputs and knowledge on this post. With this we were able to trigger Nprinting Jobs successfully as soon our Qlik Sense Jobs get completed. (Nprinting Version feb 2018)

We have recently upgraded our Nprinting version to April 2018 and I getting the following error when I try to run Nprinting Post Execution. It would really help f you guys share any input.

Error: QVX_UNEXPECTED_END_OF_DATA: HTTP protocol error 405 (Method Not Allowed):

{"message":"The requested resource does not support http method 'POST'."}

Execution Failed

Thanks

Prakash

Ruggero_Piccoli
Support
Support

Hi,

This is a new question so my suggestion is to post a new question.

Please add all the details, for example here it is hard to give you a suggestion because we need the call you did that generated the error.

Check also the firewall configuration.

Best Regards,

Ruggero

---------------------------------------------

When applicable please mark the appropriate replies as CORRECT https://community.qlik.com/docs/DOC-14806. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads as HELPFUL if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as HELPFUL if you feel additional info is useful to others.



Best Regards,
Ruggero
---------------------------------------------
When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads with a LIKE if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads with LIKEs if you feel additional info is useful to others.
h_prakash
Creator II
Creator II

Hello Piccoli,

Thanks for responding. we have just upgraded the our version. Initially I was able to run. but after upgrade we are not able to run.

I have posted a new question may be you can help in responding to that.

Any guidance is really appreciated.

Link : Qlik Sense - Nprinting API Help

Thanks

Hari

Anonymous
Not applicable

Hi


I found that I can't do load data and trigger NPrinting in one script.

Is it possible to do the following tasks in one script?

  1. load data from DB (because there is new data/ change of data in DB)
  2. trigger metadata reload for refresh the data
  3. trigger publish task to produce the report

Any suggestion?

Thanks