Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
SS3
Contributor
Contributor

Qlik Sense REST API connector

Hi, I'm trying to connect the Netsuite with oauth 1.0 via REST connector from Qlik Sense Cloud. I can successfully load the data via postman with oauth 1.0 and "Add parameters to header" option. I'm trying do the same in Qlik Sense with query Header parameters but with no success (error with "http protocol error 401 unauthorized: Requested resource required authentication" appeared). Does anybody know if this is possible and how to fix it, how to "turn on" an authorization and set the header parameters correctly?

Thank you.

Labels (1)
3 Replies
Quarry
Contributor II
Contributor II

I don't think Qliksense allows oauth

donovanredbeard
Partner - Contributor
Partner - Contributor

Some authentication requires a multi-step process.  You can use WITH CONNECTION () and supply URL, Headers, Body, etc.....

Below is an example of capturing the cookie token from an NTLM authorization.

 

See also: https://www.oauth.com/oauth2-servers/device-flow/token-request/

 

Set vHost = '127.0.0.1';
Set vPort = '4993';

LIB CONNECT TO 'REST Login'; //Setup LIB to URL auth

//Perform a GET call to NPrinting NTLM login API RestConnectorMasterTable:
SQL SELECT
"Set-Cookie",
"__KEY__response_header"
FROM JSON "_response_header" PK "__KEY__response_header";
[_response_header]:
LOAD [Set-Cookie] AS [Set-Cookie]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__KEY__response_header]);
//Extracts session cookie from the API response
let vCookieRaw = Peek('Set-Cookie',0,'_response_header');
let vCookie = TextBetween('$(vCookieRaw)','Secure,','Path=/',2);
DROP TABLE RestConnectorMasterTable;

RestAppsMasterTable:
SQL SELECT
"__KEY_data"
, (SELECT
"id",
"name", "__FK_items"
FROM "items" FK "__FK_items")
FROM JSON (wrap off) "data" PK "__KEY_data"
WITH CONNECTION( URL "https://$(vHost):$(vPort)/api/v1/apps", HTTPHEADER "cookie" "$(vCookie)" );
[apps_items]:
LOAD [id] AS [apps_appId],
[name] AS [apps_appName]
RESIDENT RestAppsMasterTable
WHERE NOT IsNull([__FK_items]);

DROP TABLE RestAppsMasterTable;

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

I've posted an example of OAuth with Jira to this thread, which may also help:

https://community.qlik.com/t5/Qlik-Connectors-Discussions/Qlik-Sense-Rest-API-Connector-for-Jira-Get...

Steve