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: 
davila
Contributor
Contributor

Problem getting full list of users with Nprinting API

Hi, I happen to have created an NPrinting API connection, so far I've been able to GET to filters, apps,connections, etc without any problems. But when I do GET user I get the error "HTTP protocol error 500. An unhandled exception occurred."

This happens to me when I try with a limit of 15 (in total I have 248 users)

For example this link if it takes me →http://nprinting.server.domain:4993/api/v1/users?limit=15

But the following longer throws me the error → http://nprinting.server.domain:4993/api/v1/users?limit=16

Please I need help on this.

Labels (1)
9 Replies
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi, 

1. Update label on the post so it reflects version of NPrinting you are using - answer will depend on the version.

2. Is user used to communicate via API full Admin in NPrinting (does it have Administrator Role?) - when using API the same restrictions apply as via UI

3. How do you execute your API?

thanks

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.
davila
Contributor
Contributor
Author

Hi, Lech.

The user I use to connect to the api has full admin permissions.

I connect from the qliksense script, I make the queries with this format:

SQL SELECT
"__KEY_data",
(SELECT
"id",
"name",
"description",
"created",
"lastUpdate",
"__FK_items"
FROM "items" FK "__FK_items")
FROM JSON (wrap off) "data" PK "__KEY_data"
WITH CONNECTION(
URL "$(vURL)",
HTTPHEADER "cookie" "$(vCookie)"
);

For example, it doesn't throw me an error when it assigned the variable vURL → http://nprinting.server.domain:4993/api/v1/apps?limit=1000

I only have the problem when I do the GET for "user".

Thanks. 

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @davila - understand, now back to my 1st point - what is the version of NPrinting you are using? And update label on the post please...

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

I have also checked on my end using my NPrinting.qvs file which I provided you link to and it works as expected loading all users data.

My code is as simple as:

$(Must_Include='$(vConnection)\Script\NPrinting.qvs');
Call NP_Authenticate
Call NP_GetUsers
 
Query limits I put in with connection parameters and details are in qvs file:
....WITH  CONNECTION( URL "$(vURL_User)", HTTPHEADER "cookie" "$(vCookie)", QUERY "Limit" "$(vQueryLimit)" )
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.
Ruggero_Piccoli
Support
Support

Hi

I just tested all limits between 1 and 20 in a Qlik NPrinting May 2023 SR1 installation and all worked correctly. I don't know which version you are using and I don't remember a solved bug on this.

HTTP error 500 is related to permissions so check the role and related rights of the user you are logged in. 

You could also check the Qlik NPrinting Log files.

Best Regards,

Ruggero



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.
davila
Contributor
Contributor
Author

Hi, this is my version NPrinting:

davila_0-1693568962676.png

 

The user I use to connect to the api has full admin permissions.

davila_1-1693569041363.png

Here I show you the message that it throws when I do limit 16

davila_2-1693569184773.png

But with limit 15 it works.

davila_3-1693569241908.png

 

Thanks for your help. 

 

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @davila 

Where did you get your script from?

Your version of NPrinting does not have all the fields you have in your statements in the API documentation https://help.qlik.com/en-US/nprinting/April2020/APIs/NP+API/index.html?page=54.

Fields in documentation for GET Users call support following structure:  

{
  "data" : {
    "totalItems" : 0,
    "offset" : 6,
    "limit" : 1,
    "items" : [ {
      "domainAccount" : "aeiou",
      "subFolder" : "aeiou",
      "created" : "2000-01-23T04:56:07.000+00:00",
      "timezone" : "aeiou",
      "alternateEmail1" : "aeiou",
      "userName" : "aeiou",
      "locale" : "de",
      "enabled" : true,
      "folder" : "aeiou",
      "alternateEmail3" : "aeiou",
      "lastUpdate" : "2000-01-23T04:56:07.000+00:00",
      "alternateEmail2" : "aeiou",
      "id" : "00000000-0000-0000-0000-000000000000",
      "email" : "aeiou"
    } ]
  }
}

 

It is hard to test anything on such old version as it is not supported for more than a year so I suggest to upgrade to currently supported version and for API call you may need to alter your SQL Select statement.

cheers

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.
davila
Contributor
Contributor
Author

Hi @Lech_Miszkiewicz 
Thank you very much for your help, I think I'll talk to my provider to update the NPrinting platform.

However, I still find it strange that I only take users with a limit less than 15.

I generated the script considering the documentation of the API on this website: 
https://help.qlik.com/en-US/nprinting/May2023/APIs/NP+API/index.html?page=0

Cheers.

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Well. You  are generating script for version May 2023 based on the link you gave us. April 2020 is much older and is different. I specifically asked you about version for that very reason. I gave you link reference to that api version so try again using it or simply create a connection to the “get users” end point and use Qlik to generate script for you while browsing table. Your syntax looks bit odd so i think it may be a reason why its not working properly. 

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.