Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE

How to Authenticate / Connect with the Qlik NPrinting API in Postman with NTLM Authentication

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

How to Authenticate / Connect with the Qlik NPrinting API in Postman with NTLM Authentication

Last Update:

Jun 17, 2021 10:40:55 AM

Updated By:

Jin_Park

Created date:

Jul 15, 2017 10:06:29 AM

Environments:

  • Qlik NPrinting June2017 and higher

Explanation:
In the following example, POSTMAN Desktop (Chrome App was deprecated) is used as a test tool, in order to demonstrate how the 'caller' can authenticate using NTLM authentication.

Nprinting authenticates via the cookie provided from the NTLM request.

  • This must be a domain user in Nprinting
  • This cookie needs to be included in all requests. 
  • If making a POST request, you need to also include the X-XSRF-TOKEN header with the value of the cookie, otherwise you will receive the error REVEL_CSRF: tokens mismatch.


In the Postman Chrome app, it was possible to use the Interceptor extension in-tandem to get the cookie from the Nprinting Console session open in the browser. However, in Desktop it is necessary to get this cookie by making the GET request to the /api/v1/login/ntlm endpoint.



Follow these steps:

 

1. Install and launch Postman Desktop
2. Under Settings, disable SSL certificate verification (otherwise Postman will say it "Could not get any response" because Nprinting uses self-signed certs)
3. Under the Authorization tab, select NTLM as the authentication Type, and then enter your credentials. Note that domain needs to be in the Domain field (do not enter an username such as domain\username; put domain in the

Domain field, and only put the username in the Username field)

1.png


4. Make a GET request to the NTLM endpoint:
 

COMMAND URL
GET https://yourdomain.com:4993/api/v1/login/ntlm

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

  • application/json (Responses are usually 200 (User is authenticated)or 403 (User is not authenticated. User may not be in the system, not bound to a windows domain or not authorized to use the APIs. ))
  • In case of a 200 response you’ll get a response like the one in the following image:
2.png
  • You can verify the cookie was set properly (and get the XSRF value) in Postman by clicking on Cookies to view the NPWEBCONSOLE_XSRF-TOKEN cookie. Postman sends this cookie with subsequent requests.
3.png4.png
 


At this point, it is now possible to make GET requests via the Nprinting API. For example, viewing available reports: 

COMMAND URL
GET https://yourdomain.com:4993/api/v1/reports

You'll get a response like this with the list of your reports:
5.png

However, if one needs to make a POST request then the X-XSRF-TOKEN header and corresponding cookie value needs to be present in the request; otherwise, the error REVEL_CSRF: tokens mismatch. will be thrown.
 

COMMAND URL
POST https://yourdomain.com:4993/api/v1/tasks/{taskID}/executions


6.png7.png


 

Labels (2)
Comments
nicoleklos
Partner - Contributor
Partner - Contributor

Thanks for this description - this helped me for 100 percent 🙂

sudeepkm_analog
Contributor III
Contributor III

very nice write up. great job.

is it possible to use custom users (created in NPrinting console) to make API calls.

or it has to be NT ID to make such calls. I'm trying to create a custom user in NPrinting and then use that user in POSTMAN to make API call using basic auth. it is not working.

Version history
Last update:
‎2021-06-17 10:40 AM
Updated by: