Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
If you have upgraded Qlik Sense recently and are having REST connection failures, please visit the following article: Qlik Sense June 2020 connecting to NPrinting getting "HTTP protocol error 403 (Forbidden): The serve...
Qlik Sense April 2019 release contains the required rest connector v2.11 which resolves a previous software defect affecting versions after 1.3 and up to 2.10
Note: The Qlik Rest connectors are not supported for use where kerberos authentication is present. See details here: Feature Request: Qlik REST connector should be able to support connections to server with Kerberos a...
The following only works in specific versions of Qlik Sense and NPrinting. Please check with a Qlik Integrations/Development support engineer with any questions.
The Qlik Sense/View Rest connector is required to be manually updated to version 1.3.
When using Qlik Sense REST connector to connect to NPrinting APIs, the connector may show error “Failed to connect to server” or “HTTP protocol error 403 (Forbidden): The server refused to fulfill the request” , although the same API call works in web browsers or Postman.
According to NPrinting reference page at http://help.qlik.com/en-US/nprinting/June2017/APIs/NP%20API/, API users need to call method GET /login/ntlm to authenticate themselves first. This will create a cookie for subsequent calls in the same session. However, unlike web browsers or API tools like Postman, Qlik Sense REST connector does not save this session cookie automatically for subsequent calls.
A workaround is to manually save the cookie after the first authentication call, then add the cookie as a query header in the REST Connector configuration.The following article presents an example for how this can be achieved:
Ref: http://help.qlik.com/en-US/nprinting/November2017/Content/Extending/Intro-Extending.htm
In Qlik Sense, when Qlik REST Connector is configured with Windows Authentication, the connector always uses credentials of the Qlik Sense service account. Therefore, the first step is to create an NPrinting user associated with the Qlik Sense service account and grant necessary roles to this user.
Check option “Include HTTP response header” and select response field “Set-Cookie”. Insert the generated script to the app.
Field “Set-Cookie” contains 3 cookies returned by NPrinting Server as a single string when GET /login/ntlm is called. The string should look like the following:
NPWEBCONSOLE_XSRF-TOKEN=V2pQHt7kUuzI4A+oe28rbyVgIyXMY8gyCdKupWjslng=; Path=/; Secure, NPWEBCONSOLE_SESSION=86e4bf552e79e4c1d0acf898a1d8e1fe10029cc4-%00NPWEBCONSOLE_XSRF-TOKEN%3AV2pQHt7kUuzI4A%2Boe28rbyVgIyXMY8gyCdKupWjslng%3D%00%00_TS%3Asession%00; Path=/; HttpOnly; Secure, NPWEBCONSOLE_SESSION=02cf571338171b5f04195cb4c02ca95cf7ee60d6-%00NPWEBCONSOLE_XSRF-TOKEN%3AV2pQHt7kUuzI4A%2Boe28rbyVgIyXMY8gyCdKupWjslng%3D%00%00_TS%3Asession%00%00userid%3A0d1021800b6f4ea78c478bef82a3c6f2%00; Path=/; HttpOnly; Secure
In which, the third cookie (highlighted in yellow, without cookie properties Path, HTTP, Secure) is needed for subsequent API calls. This cookie can be extracted from the string using any string manipulation technique in Qlik Sense. For example, the following script extract the cookie into variable vCookie:
(in this example, ‘_response_header’ is the name of the table generated by the REST connector in step 3)
This can be done either by creating a new REST connection, or overriding the current REST connection using WITH CONNECTION keyword.
SQL SELECT
"totalItems",
"offset",
"limit",
"__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 "https://qlikserver6:4993/api/v1/apps",
HTTPHEADER "cookie" "$(vCookie)"
);
Please refer to the attached qvf app for an example.