Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys!
I want to get information about user licenses from QMS API using Qlik REST Connector.
I was able to connect to the API but got stuck further. Maybe someone has a manual?
Qlikview Server 12.1.
Dynamically passing parameters to the connection - https://support.qlik.com/articles/000050753
If suddenly someone needs it, I got the following solution (draft):
// get TimeLimitedServiceKey
CUSTOM CONNECT TO
"Provider=QvRestConnector.exe;
url=http://localhost:4799/QMS/Service;
timeout=30;
method=POST;
requestBody=<s:Envelope xmlns:s%2%3http://schemas.xmlsoap.org/soap/envelope/%3>
<s:Body>
<GetTimeLimitedServiceKey xmlns%2%3http://ws.qliktech.com/QMS/12/%3>
</GetTimeLimitedServiceKey>
</s:Body>
</s:Envelope>;
autoDetectResponseType=true;
keyGenerationStrategy=0;
useWindowsAuthentication=true;
useCertificate=No;
certificateStoreLocation=CurrentUser;
certificateStoreName=My;
queryHeaders=SOAPACTION%2http://ws.qliktech.com/QMS/12/IQMS/GetTimeLimitedServiceKey%1Content-Type%2text/xml%%1charset%%2utf-8;
PaginationType=None;
XUserId=YTSNKUD;
XPassword=MefReZC;";
RestConnectorMasterTable:
SQL SELECT
"__KEY_Envelope",
(SELECT
(SELECT
"attr:xmlns" AS "xmlns",
"GetTimeLimitedServiceKeyResult",
"__FK_GetTimeLimitedServiceKeyResponse"
FROM "GetTimeLimitedServiceKeyResponse" FK "__FK_GetTimeLimitedServiceKeyResponse")
FROM "Body" PK "__KEY_Body" FK "__FK_Body")
FROM XML "Envelope" PK "__KEY_Envelope";
[GetTimeLimitedServiceKeyResponse]:
LOAD [xmlns],
[GetTimeLimitedServiceKeyResult],
[__FK_GetTimeLimitedServiceKeyResponse] AS [__KEY_Body]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_GetTimeLimitedServiceKeyResponse]);
DROP TABLE RestConnectorMasterTable;
let vTimeLimitedServiceKey = Peek('GetTimeLimitedServiceKeyResult', 0 , 'GetTimeLimitedServiceKeyResponse');
drop Table [GetTimeLimitedServiceKeyResponse];
//=====================================================
// get info about CALs
CUSTOM CONNECT TO
"Provider=QvRestConnector.exe;
url=http://localhost:4799/QMS/Service;
timeout=30;
method=POST;
requestBody=<s:Envelope xmlns:s%2%3http://schemas.xmlsoap.org/soap/envelope/%3>
<s:Body>
<GetCALConfiguration xmlns%2%3http://ws.qliktech.com/QMS/12/2/%3>
<qvsID>YOUR qvsID</qvsID>
<scope>NamedCALs</scope>
</GetCALConfiguration>
</s:Body>
</s:Envelope>;
autoDetectResponseType=true;
keyGenerationStrategy=0;
useWindowsAuthentication=true;
useCertificate=No;
certificateStoreLocation=CurrentUser;
certificateStoreName=My;
PaginationType=None;
XUserId=dHNJeKC;
XPassword=CacWJIB;";
RestConnectorMasterTable:
SQL SELECT
"__KEY_Envelope",
(SELECT
(SELECT
(SELECT
(SELECT
FROM "DocumentCALs"),
(SELECT
"AllowDynamicAssignment",
"AllowLicenseLease",
"Assigned",
"IdentificationMode",
"InLicense",
"Limit",
"RemovedAssignedCALs",
"__KEY_NamedCALs",
"__FK_NamedCALs",
(SELECT
"__KEY_AssignedCALs",
"__FK_AssignedCALs",
(SELECT
"LastUsed",
"MachineID",
"QuarantinedUntil",
"UserName",
"__FK_AssignedNamedCAL"
FROM "AssignedNamedCAL" FK "__FK_AssignedNamedCAL")
FROM "AssignedCALs" PK "__KEY_AssignedCALs" FK "__FK_AssignedCALs"),
(SELECT
"__KEY_LeasedCALs",
"__FK_LeasedCALs",
(SELECT
"LastUsed" AS "LastUsed_u0",
"MachineID" AS "MachineID_u0",
"QuarantinedUntil" AS "QuarantinedUntil_u0",
"UserName" AS "UserName_u0",
"LeasedAt",
"__FK_LeasedNamedCAL"
FROM "LeasedNamedCAL" FK "__FK_LeasedNamedCAL")
FROM "LeasedCALs" PK "__KEY_LeasedCALs" FK "__FK_LeasedCALs")
FROM "NamedCALs" PK "__KEY_NamedCALs" FK "__FK_NamedCALs"),
(SELECT
FROM "SessionCALs"),
(SELECT
FROM "UsageCALs")
FROM "GetCALConfigurationResult" PK "__KEY_GetCALConfigurationResult" FK "__FK_GetCALConfigurationResult")
FROM "GetCALConfigurationResponse" PK "__KEY_GetCALConfigurationResponse" FK "__FK_GetCALConfigurationResponse")
FROM "Body" PK "__KEY_Body" FK "__FK_Body")
FROM XML "Envelope" PK "__KEY_Envelope"
WITH CONNECTION(
HTTPHEADER "SOAPACTION" "http://ws.qliktech.com/QMS/12/2/IQMS2/GetCALConfiguration",
HTTPHEADER "Content-Type" "text/xml;charset=utf-8",
HTTPHEADER "X-Service-Key" "$(vTimeLimitedServiceKey)"
);
[AssignedNamedCAL]:
LOAD [LastUsed],
[MachineID],
[QuarantinedUntil],
[UserName],
[__FK_AssignedNamedCAL] AS [__KEY_AssignedCALs]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_AssignedNamedCAL]);
[AssignedCALs]:
LOAD [__KEY_AssignedCALs],
[__FK_AssignedCALs] AS [__KEY_NamedCALs]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_AssignedCALs]);
[LeasedNamedCAL]:
LOAD [LastUsed_u0],
[MachineID_u0],
[QuarantinedUntil_u0],
[UserName_u0],
[LeasedAt],
[__FK_LeasedNamedCAL] AS [__KEY_LeasedCALs]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_LeasedNamedCAL]);
[LeasedCALs]:
LOAD [__KEY_LeasedCALs],
[__FK_LeasedCALs] AS [__KEY_NamedCALs]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_LeasedCALs]);
[NamedCALs]:
LOAD [AllowDynamicAssignment],
[AllowLicenseLease],
[Assigned],
[IdentificationMode],
[InLicense],
[Limit],
[RemovedAssignedCALs],
[__KEY_NamedCALs],
[__FK_NamedCALs] AS [__KEY_GetCALConfigurationResult]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_NamedCALs]);
DROP TABLE RestConnectorMasterTable;
I understood main principles - https://support.qlik.com/articles/000053853:
First step you need to get a service key - https://support.qlik.com/articles/000038854
I did it.
The next step is to get the number of user licenses. I call method "GetCALConfiguration" with correct header and required parameters. But i'm having difficulties with the request body format.
Are there ways to automatically generate the request body?
I found an example request body for method GetCALConfiguration here - https://support.qlik.com/articles/000061350
Dynamically passing parameters to the connection - https://support.qlik.com/articles/000050753
If suddenly someone needs it, I got the following solution (draft):
// get TimeLimitedServiceKey
CUSTOM CONNECT TO
"Provider=QvRestConnector.exe;
url=http://localhost:4799/QMS/Service;
timeout=30;
method=POST;
requestBody=<s:Envelope xmlns:s%2%3http://schemas.xmlsoap.org/soap/envelope/%3>
<s:Body>
<GetTimeLimitedServiceKey xmlns%2%3http://ws.qliktech.com/QMS/12/%3>
</GetTimeLimitedServiceKey>
</s:Body>
</s:Envelope>;
autoDetectResponseType=true;
keyGenerationStrategy=0;
useWindowsAuthentication=true;
useCertificate=No;
certificateStoreLocation=CurrentUser;
certificateStoreName=My;
queryHeaders=SOAPACTION%2http://ws.qliktech.com/QMS/12/IQMS/GetTimeLimitedServiceKey%1Content-Type%2text/xml%%1charset%%2utf-8;
PaginationType=None;
XUserId=YTSNKUD;
XPassword=MefReZC;";
RestConnectorMasterTable:
SQL SELECT
"__KEY_Envelope",
(SELECT
(SELECT
"attr:xmlns" AS "xmlns",
"GetTimeLimitedServiceKeyResult",
"__FK_GetTimeLimitedServiceKeyResponse"
FROM "GetTimeLimitedServiceKeyResponse" FK "__FK_GetTimeLimitedServiceKeyResponse")
FROM "Body" PK "__KEY_Body" FK "__FK_Body")
FROM XML "Envelope" PK "__KEY_Envelope";
[GetTimeLimitedServiceKeyResponse]:
LOAD [xmlns],
[GetTimeLimitedServiceKeyResult],
[__FK_GetTimeLimitedServiceKeyResponse] AS [__KEY_Body]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_GetTimeLimitedServiceKeyResponse]);
DROP TABLE RestConnectorMasterTable;
let vTimeLimitedServiceKey = Peek('GetTimeLimitedServiceKeyResult', 0 , 'GetTimeLimitedServiceKeyResponse');
drop Table [GetTimeLimitedServiceKeyResponse];
//=====================================================
// get info about CALs
CUSTOM CONNECT TO
"Provider=QvRestConnector.exe;
url=http://localhost:4799/QMS/Service;
timeout=30;
method=POST;
requestBody=<s:Envelope xmlns:s%2%3http://schemas.xmlsoap.org/soap/envelope/%3>
<s:Body>
<GetCALConfiguration xmlns%2%3http://ws.qliktech.com/QMS/12/2/%3>
<qvsID>YOUR qvsID</qvsID>
<scope>NamedCALs</scope>
</GetCALConfiguration>
</s:Body>
</s:Envelope>;
autoDetectResponseType=true;
keyGenerationStrategy=0;
useWindowsAuthentication=true;
useCertificate=No;
certificateStoreLocation=CurrentUser;
certificateStoreName=My;
PaginationType=None;
XUserId=dHNJeKC;
XPassword=CacWJIB;";
RestConnectorMasterTable:
SQL SELECT
"__KEY_Envelope",
(SELECT
(SELECT
(SELECT
(SELECT
FROM "DocumentCALs"),
(SELECT
"AllowDynamicAssignment",
"AllowLicenseLease",
"Assigned",
"IdentificationMode",
"InLicense",
"Limit",
"RemovedAssignedCALs",
"__KEY_NamedCALs",
"__FK_NamedCALs",
(SELECT
"__KEY_AssignedCALs",
"__FK_AssignedCALs",
(SELECT
"LastUsed",
"MachineID",
"QuarantinedUntil",
"UserName",
"__FK_AssignedNamedCAL"
FROM "AssignedNamedCAL" FK "__FK_AssignedNamedCAL")
FROM "AssignedCALs" PK "__KEY_AssignedCALs" FK "__FK_AssignedCALs"),
(SELECT
"__KEY_LeasedCALs",
"__FK_LeasedCALs",
(SELECT
"LastUsed" AS "LastUsed_u0",
"MachineID" AS "MachineID_u0",
"QuarantinedUntil" AS "QuarantinedUntil_u0",
"UserName" AS "UserName_u0",
"LeasedAt",
"__FK_LeasedNamedCAL"
FROM "LeasedNamedCAL" FK "__FK_LeasedNamedCAL")
FROM "LeasedCALs" PK "__KEY_LeasedCALs" FK "__FK_LeasedCALs")
FROM "NamedCALs" PK "__KEY_NamedCALs" FK "__FK_NamedCALs"),
(SELECT
FROM "SessionCALs"),
(SELECT
FROM "UsageCALs")
FROM "GetCALConfigurationResult" PK "__KEY_GetCALConfigurationResult" FK "__FK_GetCALConfigurationResult")
FROM "GetCALConfigurationResponse" PK "__KEY_GetCALConfigurationResponse" FK "__FK_GetCALConfigurationResponse")
FROM "Body" PK "__KEY_Body" FK "__FK_Body")
FROM XML "Envelope" PK "__KEY_Envelope"
WITH CONNECTION(
HTTPHEADER "SOAPACTION" "http://ws.qliktech.com/QMS/12/2/IQMS2/GetCALConfiguration",
HTTPHEADER "Content-Type" "text/xml;charset=utf-8",
HTTPHEADER "X-Service-Key" "$(vTimeLimitedServiceKey)"
);
[AssignedNamedCAL]:
LOAD [LastUsed],
[MachineID],
[QuarantinedUntil],
[UserName],
[__FK_AssignedNamedCAL] AS [__KEY_AssignedCALs]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_AssignedNamedCAL]);
[AssignedCALs]:
LOAD [__KEY_AssignedCALs],
[__FK_AssignedCALs] AS [__KEY_NamedCALs]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_AssignedCALs]);
[LeasedNamedCAL]:
LOAD [LastUsed_u0],
[MachineID_u0],
[QuarantinedUntil_u0],
[UserName_u0],
[LeasedAt],
[__FK_LeasedNamedCAL] AS [__KEY_LeasedCALs]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_LeasedNamedCAL]);
[LeasedCALs]:
LOAD [__KEY_LeasedCALs],
[__FK_LeasedCALs] AS [__KEY_NamedCALs]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_LeasedCALs]);
[NamedCALs]:
LOAD [AllowDynamicAssignment],
[AllowLicenseLease],
[Assigned],
[IdentificationMode],
[InLicense],
[Limit],
[RemovedAssignedCALs],
[__KEY_NamedCALs],
[__FK_NamedCALs] AS [__KEY_GetCALConfigurationResult]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_NamedCALs]);
DROP TABLE RestConnectorMasterTable;