Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Announcements
See why Qlik is recognized as a Leader for the 10th year in a row – and discover how Qlik can help put your business in the lead. Get Report
Partner
Partner

Rest connector: With connection + Authentication scheme

Hello all,

I've a question about the with connection statement. I want the connection variable, so I have to use the with connection statement. In my rest connection I use the authentication scheme basic with an username and password. I need to know how to write this scheme in the with connection!?!?

I loaded the normal rest conn table and instead of the conn string I used a dummy conn. In addition I add (FROM JSON (wrap on) "root" PK "__KEY_root") to the FROM Clause. Thereafter the with connection statement. Here is an example of what I  reached so far:

LIB CONNECT TO 'Dummyconnection';

RestConnectorMasterTable:
SQL SELECT
"__KEY_reportAssessments_v2_0s",
(SELECT
"ALL_FIELDS",
"__FK_ReportAssessment_v2_0"
FROM "ReportAssessment_v2_0" FK "__FK_ReportAssessment_v2_0")
FROM XML "reportAssessments_v2_0s" PK "__KEY_reportAssessments_v2_0s"
FROM JSON (wrap on) "root" PK "__KEY_root"

WITH CONNECTION(
Url "$(URL)",
HTTPHEADER "Authorization: Basic $(username):$(password)"
);

Please let my know what I have to change, because it's not working now. Qlik support told me I could possible use this: Authorization: Basic <credentials>, where credentials is the base64 encoding of id and password joined by a single colon :.

Thanks in advance!!

1 Reply
Highlighted
Mehrnaz
New Contributor

Re: Rest connector: With connection + Authentication scheme

Hi,

What I had to use is different, but I had double quote around "Authorization" and double quote around the entire value of it. Maybe try to assign the whole value part of it to a variable and use it that way and see if it helps:

 

 

LET vAuthorization = 'Basic ' & '$(username)' & ':' & '$(password)';

SQL Select ...

HTTPHEADER "Authorization" "$(vAuthorization)"

 

 

Mehrnaz