Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone, I need to ask:
I’ve a rest connection API (CORESYSTEMS) script from QlikView. This connection needs Access Token, this finish 5 – 6 per hour and must be refresh. The next script get the Access Token:
------------------------------------------------------------------------------------------------------------------------------------------------
CUSTOM CONNECT TO "Provider=QvRestConnector.exe;
url=https://auth.coresuite.com/api/oauth2/v1/token;
timeout=30;
method=POST;
requestBody=grant_type%2client_credentials;
httpProtocol=1.1;
isKeepAlive=1;
bodyEncoding=UTF-8;
sendExpect100Continue=1;
autoDetectResponseType=1;
checkResponseTypeOnTestConnection=1;
keyGenerationStrategy=0;
authSchema=anonymous;
skipServerCertificateValidation=0;
useCertificate=No;
certificateStoreLocation=CurrentUser;
certificateStoreName=My;
addMissingQueryParametersToFinalRequest=0;
queryHeaders=Content-Type%2application/x-www-form-urlencoded%1authorization%2Basic *****%%2;
PaginationType=None;
allowResponseHeaders=0;
allowHttpsOnly=0;
XUserId=****;
XPassword=****;";
RestConnectorMasterTable2:
SQL SELECT
"__KEY_root",
"access_token"
FROM JSON (wrap on) "root" PK "__KEY_root";
[token]:
LOAD [access_token],
[__KEY_root]
RESIDENT RestConnectorMasterTable2
WHERE NOT IsNull([__KEY_root]);
LET vtoken = Peek('access_token', 0, 'token'); // AQUÍ GUARDO EL TOKEN
Trace $(vtoken);
DROP TABLE RestConnectorMasterTable2;
------------------------------------------------------------------------------------------------------------------------------------------------
Right now must input the Access Token in the next script, qith this finally I’ll get the API’s data:
------------------------------------------------------------------------------------------------------------------------------------------------
CUSTOM CONNECT TO "Provider=QvRestConnector.exe;
url=https://us.coresuite.com/api/query/v1;
timeout=30;
method=POST;
requestBody={%3query%3: %3
SELECT cte.id as id
, cte.lastChanged as lastChanged
, cte.value as Detenido
, sc.code as callID
from ServiceCall sc JOIN Activity a ON a.object.objectId%2sc.id
JOIN ChecklistInstance ci ON ci.object.objectId%2a.id
JOIN ChecklistTemplate ct ON ci.template%2ct.id
JOIN ChecklistInstanceElement cte ON cte.checklistInstance%2ci.id
WHERE cte.lastChanged >%2'2020-01-01T00:00:00Z'
AND cte.title %2 'Equipo Detenido'
AND cte.value %2 'true' %3};
httpProtocol=1.1;
isKeepAlive=1;
bodyEncoding=UTF-8;
sendExpect100Continue=1;
autoDetectResponseType=1;
checkResponseTypeOnTestConnection=1;
keyGenerationStrategy=0;
authSchema=anonymous;
skipServerCertificateValidation=0;
useCertificate=No;
certificateStoreLocation=CurrentUser;
certificateStoreName=My;
queryParameters=account%2****%1company%2****%1clientIdentifier%2COR_NON_NONE%1dtos%2ServiceCall.21%%1ChecklistInstanceElement.12%%1ChecklistInstance.14%%1ChecklistTemplate.18%%1Activity.21;
addMissingQueryParametersToFinalRequest=0;
queryHeaders=Content-Type%2application/json%1X-client-ID%****%1X-Client-Version%21.0%1Authorization%2Bearer Access_token;
PaginationType=NextPage;
NextPageField=page;
IsNextPageFieldHeader=0;
NextPageFieldValue=1;
NextPageSizeFieldName=pageSize;
IsNextPageSizeFieldHeader=0;
NextPageSizeFieldValue=50;
NextPageTotalPath=root/lastPage;
IsNextPageTotalPathHeader=0;
NextPageDataPath=root/data;
allowResponseHeaders=0;
allowHttpsOnly=0;
XUserId=****;
XPassword=****;";
RestConnectorMasterTable:
SQL SELECT
"__KEY_root",
(SELECT
"callID",
"detenido",
"lastChanged",
"id",
"__KEY_data",
"__FK_data"
FROM "data" PK "__KEY_data" FK "__FK_data")
FROM JSON (wrap on) "root" PK "__KEY_root";
[data]:
LOAD [callID]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_data]);
DROP TABLE RestConnectorMasterTable;
------------------------------------------------------------------------------------------------------------------------------------------------
Actually I copy/paste the Access Token from POSTMAN to QLIKVIEW. How I input the Access Token, previousy saved in a String Variable, in the script that extracts the data from CORESYSTEM?
Thanks for all.
Blessings