Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
QlikviewRaj11
Contributor III
Contributor III

is it possible to get the token dynamically from RestConnector in Qlikview 12.4...

Hi, I have this scenario where I need to connect to an API using the RestConnector.exe and the connection was successful but the problem is the authorization key expires in around 8 to 10 hours which means I cannot sue the auth key as one time password... I went through some posts and noticed that this works in Qliksense but not in Qlikview...

is it still the same ? Thanks a lot for your time

2 Replies
Brett_Bleess
Former Employee
Former Employee

Best place I can point you is the Help to be sure you have reviewed all the available information there:

https://help.qlik.com/en-US/connectors/Subsystems/REST_connector_help/Content/Connectors_REST/REST-c...

If you do not find what you need, the other thing would likely be to check the Ideas area of Community to see if there is anything there regarding this functionality request and if not, you can create a new request...

https://community.qlik.com/t5/Ideas/idb-p/qlik-ideas

Sorry I do not have anything better for you.  

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
daudballing
Partner - Contributor III
Partner - Contributor III

Consider splitting the request into two parts.

The first API request GETs the token and saves  the token into a variable.

The second API call uses that variable in the data load request. Note: I'm using two different data connections in the below example. Something like this:

First part

LIB CONNECT TO 'API_TOKEN_REFRESH';

TokenRefresh:
SQL SELECT
"token",
"__KEY_root"
FROM JSON (wrap on) "root" PK "__KEY_root";

[root]:
LOAD [token],
[__KEY_root]
RESIDENT TokenRefresh
WHERE NOT IsNull([__KEY_root]);

// Variable placeholder for autogenerated token
LET vToken = peek('token', 0, 'root');
DROP TABLE root;

Second Part where the important thing is in the 'WITH CONNECTION' part. I think there is a in-depth documentation somewhere on the Qlik site.

LIB CONNECT TO 'API_GET_DATA_REQUEST';  

ExampleDataTable:
SQL SELECT
"id",
"SomeField",
"AnotherField"
FROM "SomeTable" PK "__KEY_root" )
FROM JSON (wrap on) "root" PK "__KEY_root"
WITH CONNECTION (
URL "https://api.yourservice.com/your-end-point",
QUERY "dataType" "good",
HTTPHEADER "auth" "$(vToken)"
);

// The rest of the your JSON tables structure follows here... 

Hope it works for you  -

Cheers