Skip to main content

How to manage Qlik NPrinting users by using API

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
Ruggero_Piccoli
Support
Support

How to manage Qlik NPrinting users by using API

Last Update:

Apr 19, 2022 7:31:52 AM

Updated By:

Sonja_Bauernfeind

Created date:

Mar 18, 2021 11:49:21 AM

This document describes some examples of Qlik NPrinting APIs used to manage users using POSTMAN.

NOTE: Before proceeding below, ensure that the user which is used for authentication (in the following) should have the NPrinting 'Administrator' security role assigned to it.

To login:

  1. Open POSTMAN
  2. Create a get /login/ntlm call to your Qlik NPrinting server address. https://help.qlik.com/en-US/nprinting/November2020/APIs/NP+API/index.html?page=9#Users
  3. Open the Authorization tab
  4. Set NTLM in the TYPE dropdown menu
  5. Insert your username, password and domain. They must be the credentials of a Windows user that is also a Qlik NPrinting user with the related domain account configured.
  6. Click on Send. If everything is fine you will receive a status 200 ok as answer.
  7. I suggest you to save this tab for future usages

Ruggero_Piccoli_0-1611065145109.png

We can retrieve the list of all available users by using a get /users call https://help.qlik.com/en-US/nprinting/November2020/APIs/NP+API/index.html?page=56:

  1. Open a new tab
  2. Insert the get /users call and run it
  3. In the Body you will see the JSON with all your users
  4. You could also save this API call for future usages

Ruggero_Piccoli_1-1611065385407.png

We want to use APIs to delete the user with id 2511d333-0e3b-4a05-a1fa-5918cbef5e19. The user ID is visible in JSON retrived before and, if you open its profile in a web browser, in the related URL that appears like https://YourServer:4993/#/admin/users/2511d333-0e3b-4a05-a1fa-5918cbef5e19

The delete /users/{id} is described in https://help.qlik.com/en-US/nprinting/November2020/APIs/NP+API/index.html?page=57

Before proceeding we need to retrieve the connection X-XSRF-TOKEN from the get ntml/login call. Open it and click on Cookies on the right side.

 

Click on the NPWEBCONSOLE_XSRF-TOKEN tab. Select the token string from the first character after the equal sign to the semicolon and copy it. We will use that token code in the DELETE API. 

2021-01-19 15_46_28-Postman.png

To run the DELETE API:

  • Create a new POSTMAN tab
  • Select DELETE from the drop down menu on the left side
  • Insert the DELETE URL. It looks like https://YourServer:4993/api/v1/users/2511d333-0e3b-4a05-a1fa-5918cbef5e19
  • Click on the Headers tab
  • Insert the Key X-XSRF-TOKEN
  • Insert the Value of the token we retrieved before
  • Click on Send
  • You can save the call for future usages. In this case you have to start by running the get NTLM connection API again and retrieve the new X-XSRF-TOKEN connection token because it is different for every session.  

2021-01-19 15_59_08-Postman.png

If you refresh the web browser tab where you opened the user profile you will get an error because it is no more available.

2021-01-19 16_01_22-Qlik NPrinting.png

 

 

Labels (1)
Comments
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

It is a great start to learn the API. One thing to add to the above is that the user which we use for authentication needs to have a NPrinting role which will allow him to use API (Admin role will do 🙂

Ruggero_Piccoli
Support
Support

@Lech_Miszkiewicz Thanks for the suggestion! I'm not able to edit the article, but the user must have a role with the On-Demand -> Create privilege flagged on the Roles administration page for the correct Qlik NPrinting Apps.

 

Frank_S
Support
Support

Note added...thanks @Lech_Miszkiewicz 

Version history
Last update:
‎2022-04-19 07:31 AM
Updated by: