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: 
blaise
Partner - Specialist
Partner - Specialist

Cannot connect to NPrinting API with QvRestConnector 1.3

Hi fellow forum members

Im trying to fetch Users from NPrinting API using the Qv Rest Connector 1.3 from QlikView.

I've followed the guide How to use Qlik NPrinting APIs inside a Qlik Sense load script but for some reason it doesn't work.

I've successfully connected to the /login/ntlm endpoint and extracted the cookie but when i try the following script it doesn't work (QVX_UNEXPECTED_END_OF_DATA: HTTP protocol error 500 (Internal Server Error).

RestUserMasterTable:

SQL SELECT

"__KEY_data",

(SELECT

"id",

"email",

"__FK_items"

FROM "items" FK "__FK_items")

FROM JSON (wrap off) "data" PK "__KEY_data"

WITH CONNECTION( URL "https://fullservername:4993/api/v1/users", HTTPHEADER "cookie" "$(vCookie)" );

Im trying with a user with Administrator role in NP.

Port 4993 is open as i can use web console without any issues

Qv Rest Connector is of version 1.3 (i've installed it after Qlik Sense and have also tried to uninstall Qlik Sense before and install Qv Rest Connector afterwards)

I've tried both Nov17 and Feb18 releases.

I've added <ALL> logging to QvRestConnector but that didn't gave me any meaningful info.

The exact same qvw (except the servername in the url) is working on other NP Installations running both Nov17 and Feb18.

1 Solution

Accepted Solutions
blaise
Partner - Specialist
Partner - Specialist
Author

I found the issue!

TLDR;

A user locale was zh-CN, the API didn't liked that (seem to be issues with "-" sign in the locale).

When looking through the engine log (for an other issue) I found a few entries with "Locale.Locale Source value zh-CN.

I recall i saw something on the forum with a user that had a "-" in his own locale and got a bit curious.

I started with querying another end point which worked!

I removed the users with this locale and the users endpoint started to work as well.

Its quite interesting that a users locale can break the API call.

Thanks lech_miszkiewicz‌ for trying to answer!

View solution in original post

13 Replies
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Jonah,

Your error is generic and it does not provide any valid information.

I have followed all steps from this topic and it all works for me both in Qlik Sense and in QlikView

How To Use NPrinting APIs In A Qlik Load Script

Keep in mind to add trusted origin in NPrinitng and REST connection as per this document.

Regards

Lech

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

BY THE WAY - for QlikView i had to download  and install REST connector separately from Qlik download page.

regards

Lech

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
blaise
Partner - Specialist
Partner - Specialist
Author

I thought that Origin was only needed for POST.

Nevertheless, I added both a trusted origin in NP and a Query Header Origin without any success (same error message).

blaise
Partner - Specialist
Partner - Specialist
Author

did the same. I've also removed all QV Rest + Sense and installed QV Rest 1.3 again without any progress.

I've also tried on QV directly on the NP box as well as from a Sense installation (feb18 release)

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

yes - you are right regarding the POST and adding Trusted Origin - my mistake, sorry.

On the other hand,

can you export your script to qvs and attach it here.

I looked at your code and it looks all good - I have exactly the same code, so I am thinking you might have wrong connection at the time when you are trying to use "WITH CONECTION..."

The idea when using this code is that you need to:

have a GET call to LOGIN and right after you can you get users with "WITH CONNECTION..." clause..

regards

Lech

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
blaise
Partner - Specialist
Partner - Specialist
Author

I found the issue!

TLDR;

A user locale was zh-CN, the API didn't liked that (seem to be issues with "-" sign in the locale).

When looking through the engine log (for an other issue) I found a few entries with "Locale.Locale Source value zh-CN.

I recall i saw something on the forum with a user that had a "-" in his own locale and got a bit curious.

I started with querying another end point which worked!

I removed the users with this locale and the users endpoint started to work as well.

Its quite interesting that a users locale can break the API call.

Thanks lech_miszkiewicz‌ for trying to answer!

blaise
Partner - Specialist
Partner - Specialist
Author

I thought that zh-CN was incorrect (the user was added with an import task) so i changed the locale for the given user in the web-console to first english, saved and then selected chinese and saved.

Same local in db (zh-CN) and the Users API End-point does not work.

I will register a case with Qlik

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Johan,

thanks for sharing this - it is very useful information and frankly hard nut to crack.

regards

Lech

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

btw - apologies - i have misspelt your name few times - it was not intensional - sorry

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.