Qlik Community

Integration, Extension & APIs

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

cancel
Showing results for 
Search instead for 
Did you mean: 
Lemac
Contributor III
Contributor III

Dynamically set token in REST-connector queryHeaders (TopDesk)

Dear all,

Using Qlik Sense, I am trying to connect through REST to TopDesk.

They use a token with a limited validity of only 8 hours. 

 

I set up a REST connector, and am trying to automate the refreshing of the token. My LIB-connector looks like this:

 

CUSTOM CONNECT TO "provider=QvRestConnector.exe;
url=https://company.topdesk.net/tas/api/incidents?start%210;timeout=30;readwritetimeout=300;method=GET;h...;
isKeepAlive=true;
bodyEncoding=UTF-8;
sendExpect100Continue=true;
autoDetectResponseType=true;
checkResponseTypeOnTestConnection=true;
keyGenerationStrategy=0;
XMLDTD=0;
authSchema=anonymous;
serverCertificateValidation=UseTrust;
useCertificate=No;certificateStoreLocation=LocalMachine;
certificateStoreName=My;
addMissingQueryParametersToFinalRequest=false;
queryHeaders=Authorization%2TOKEN id%%2%%383dd4d97-02d7-4574-a807-911c97ffeda0%%3%1;
PaginationType=None;
allowResponseHeaders=false;
allowHttpsOnly=false;
isCookieContainerEnabled=false;
useProxy=false;proxyBypassOnLocal=false
;proxyUseDefaultCredentials=true;"

 

This worked yesterday, but the token has expired. 

 

So now I am trying to override that token by using WITH CONNECTION in my query.

RestConnectorMasterTable:
SQL SELECT
"id" AS "id_u16"

...

)
FROM JSON (wrap on) "root" PK "__KEY_root"


WITH CONNECTION(
QUERY "queryHeaders" "Authorization%2TOKEN id%%2%%30a0dd5ba-84ee-451c-a512-78bd87f7e054%%3%1"
);

 

However, this doesn't seem to work; I still get the 401-error. What is it I am doing wrong?

 

 

 

Labels (1)
1 Solution

Accepted Solutions
NadiaB
Support
Support

Hi @Lemac

 

Have you seen this already ?

 

https://community.qlik.com/t5/Qlik-Sense-Documents/Handling-Refresh-Tokens-with-the-Qlik-REST-Connec...

 

Please don't forget to mark the response as "Solution Accepted"

 

Thank you!

Note: if this suggestion helps to resolve the issue or answers your question, it will be appreciated if you select the "Accept as Solution" option.
We encourage you to visit our Knowledge Base https://qliksupport.force.com/QS_CoveoSearch when trying to find a solution related and not limited to: errors, feature requests, product defects. You can also visit our Qlik Help portal https://help.qlik.com/

View solution in original post

2 Replies
NadiaB
Support
Support

Hi @Lemac

 

Have you seen this already ?

 

https://community.qlik.com/t5/Qlik-Sense-Documents/Handling-Refresh-Tokens-with-the-Qlik-REST-Connec...

 

Please don't forget to mark the response as "Solution Accepted"

 

Thank you!

Note: if this suggestion helps to resolve the issue or answers your question, it will be appreciated if you select the "Accept as Solution" option.
We encourage you to visit our Knowledge Base https://qliksupport.force.com/QS_CoveoSearch when trying to find a solution related and not limited to: errors, feature requests, product defects. You can also visit our Qlik Help portal https://help.qlik.com/
Lemac
Contributor III
Contributor III
Author

Thank you for your reply. This is a good step in the right direction, but one thing eludes me. How is the connection you initially make related to the 'HTTPHEADER'-clause. In the provided example; all of the sudden the word 'Bearer' appears in the HTTPHEADER. But why? Should it always be there? 

 

As for me:  A new connection works, but I can't even overwrite the connection with the same values, let alone with a new token. 

TopDesk_Totaal.png