Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Defect acknowledgement with Nprinting Engine May 2022 SR2, please READ HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
slogue1234
Contributor
Contributor

Extract roles ids using NPrinting API

Hi, I have been using an NPrinting API connection in Qlikview, so far I've been able to GET to users, apps, connections, etc without any problems. 

However, I can't figure out how to pull the Role IDs associated with individual User IDs - the "items" column returns null:

RestUserMasterTable: 
SQL SELECT 
    "totalItems" ,
    "offset" ,
    "limit" ,
    "items" ,
"__KEY_data",
FROM JSON (wrap off) "data" PK "__KEY_data" 
WITH CONNECTION( URL "https://nprintingserver.domain.com:4993/api/v1/users/$(vUserid)/roles", HTTPHEADER "cookie" "$(vCookie)", 
                QUERY "Limit" "1000000",); 

 

slogue1234_0-1722597808471.png

 

I can't find anything in the documentation that parses the array

Thanks

 

Labels (2)
1 Solution

Accepted Solutions
slogue1234
Contributor
Contributor
Author

Hi 
 
Thanks for your replies - unfortunately I am unable to use any solution that requires Qlik Sense. 
 
I was able to get my code to work with the below amendment:
 
RestUserMasterTable: 
SQL SELECT 
    "totalItems" ,
    "offset" ,
    "limit" ,
    "__KEY_data",
 
(SELECT 
           "@Value" as "@Value_u1"
FROM "items" FK "__FK_items" ArrayValueAlias "@Value_u1" )
 
FROM JSON (wrap off) "data" PK "__KEY_data" 
WITH CONNECTION( URL "https://nprintingserver.domain.com:4993/api/v1/users/$(vUserid)/roles", HTTPHEADER "cookie" "$(vCookie)", 
                QUERY "Limit" "1000000",); 

View solution in original post

4 Replies
Frank_S
Support
Support

Hello

I suggest trying the Nprinting governance dashboard as it may meet your requirement.

https://community.qlik.com/t5/Official-Support-Articles/Qlik-NPrinting-Governance-Dashboard-Version-...

Kind regards...

Please remember hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Ruggero_Piccoli
Support
Support

Hi,

Please when opening a new conversation add only the label of the version you are using: the answer could depend on it. Be also sure you are using a supported environment.

You are using the right API call https://help.qlik.com/en-US/nprinting/February2024/APIs/NP+API/index.html?page=70. If the selected use has roles their IDs will be included in the JSON answer:

Ruggero_Piccoli_0-1722843484452.png

I removed the roles of the selected user via UI and re-run the GET call:

Ruggero_Piccoli_1-1722843552173.png

So be sure the selected user has roles assigned.

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.
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @slogue1234 

I have written required subroutines in my NPrinting.qvs which covers most of the API endpoints. Feel free to have a look it should be all straightforward there.

https://nprintingadventures.com/2019/04/08/nprinting-api-qlik-rest-subroutines/

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

Hi 
 
Thanks for your replies - unfortunately I am unable to use any solution that requires Qlik Sense. 
 
I was able to get my code to work with the below amendment:
 
RestUserMasterTable: 
SQL SELECT 
    "totalItems" ,
    "offset" ,
    "limit" ,
    "__KEY_data",
 
(SELECT 
           "@Value" as "@Value_u1"
FROM "items" FK "__FK_items" ArrayValueAlias "@Value_u1" )
 
FROM JSON (wrap off) "data" PK "__KEY_data" 
WITH CONNECTION( URL "https://nprintingserver.domain.com:4993/api/v1/users/$(vUserid)/roles", HTTPHEADER "cookie" "$(vCookie)", 
                QUERY "Limit" "1000000",);