Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Aug 3, 2021 7:35:11 AM
Oct 14, 2019 5:50:14 AM
This article explains how to fetch/change QlikView Server Service (QVS) settings using the QMS API with PowerShell.
Before performing a call, you need to get a Service Key. This is used for most of API calls towards the QMS API.
## URL for the QMS API endpoint $url = "http://servername:4799/QMS/Service" $service = New-WebServiceProxy -Uri $url -Namespace QlikViewServer -UseDefaultCredential $serviceKey = $service.GetTimeLimitedServiceKey()
In return you will get a temporary Service Key which will expired 60 seconds after it was generated.
Now that you have the Service Key, you can reuse it to perform API calls against the QMS API.
Below is how you would fetch current QlikView Server settings. The QVS ID can be found in the QVPR in C:\ProgramData\QlikTech\ManagementService\QVPR\QVSCluster.xml
$qvsid = '5089db7b-0501-4b6d-b513-ee0c89107270' $hdrs = @{} $hdrs.Add("SOAPACTION","http://ws.qliktech.com/QMS/12/2/IQMS2/GetQVSSettings") $hdrs.Add("Content-Type", "text/xml;charset=utf-8") $hdrs.Add('X-Service-Key',$serviceKey) $body = @{} $body = '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body> <GetQVSSettings xmlns="http://ws.qliktech.com/QMS/12/2/"> <qvsID>' + $qvsid + '</qvsID> <scope>All</scope> </GetQVSSettings> </s:Body> </s:Envelope>' $res = Invoke-WebRequest -Uri $url -Method Post -Body $body -UseDefaultCredential -Headers $hdrs ##Display result $res
In order to change the QVS settings, the following API call can be used, settings to change must be passed in the body.
$hdrs = @{} $hdrs.Add("SOAPACTION","http://ws.qliktech.com/QMS/12/2/IQMS2/SaveQVSSettings") $hdrs.Add("Content-Type", "text/xml;charset=utf-8") $hdrs.Add('X-Service-Key',$serviceKey) $body = @{} $body = '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body> <SaveQVSSettings xmlns="http://ws.qliktech.com/QMS/12/2/"> <qvsSettings xmlns:a="http://schemas.datacontract.org/2004/07/PIX.QMSAPI.DataObjects" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <a:Cluster> <a:AlternateBuildNumber>-1</a:AlternateBuildNumber> <a:AlternateDocumentRootFolder/> <a:License> <a:AllowsClustering>true</a:AllowsClustering> <a:ControlNumber i:nil="true"/> <a:SerialNumber>99************84</a:SerialNumber> </a:License> <a:Members> <a:QVSClusterMember> <a:Address> qvp://qlikserver1/ </a:Address> <a:ExternalMachineName/> <a:ID> 3ad93615-0e42-415d-a214-a7aac2827c4c </a:ID> </a:QVSClusterMember> </a:Members> </a:Cluster> <a:Distribution> <a:Accounts/> <a:IsPublisherQDS> true </a:IsPublisherQDS> <a:QDSID> ff10579f-9dad-497b-a095-7c547b9c15fe </a:QDSID> </a:Distribution> <a:Documents> <a:Objects> <a:AllowMoveObjects> true </a:AllowMoveObjects> <a:DefaultLabelOthers> Others </a:DefaultLabelOthers> <a:DefaultLabelTotal> Total </a:DefaultLabelTotal> </a:Objects> <a:Server> <a:AllowAnonymousServerBookmarkCollaboration> false </a:AllowAnonymousServerBookmarkCollaboration> <a:AllowDocumentDownload> true </a:AllowDocumentDownload> <a:AllowDocumentUpload> true </a:AllowDocumentUpload> <a:AllowPrintAndExport> true </a:AllowPrintAndExport> <a:AllowServerAnnotations> true </a:AllowServerAnnotations> <a:AllowServerCollaboration> true </a:AllowServerCollaboration> <a:AllowSessionCollaboration> true </a:AllowSessionCollaboration> <a:OverlayDocuments> true </a:OverlayDocuments> <a:ProhibitQVPXSessionRecovery> false </a:ProhibitQVPXSessionRecovery> <a:Timeout> 480 </a:Timeout> </a:Server> </a:Documents> <a:Folders> <a:System> <a:ExportTemporaryFolder/> </a:System> <a:UserDocumentAdministrators/> <a:UserDocumentMounts/> <a:UserDocumentRootFolder> C:\ProgramData\QlikTech\Documents </a:UserDocumentRootFolder> </a:Folders> <a:General> <a:Name> QVS@qlikserver1 </a:Name> <a:Password/> <a:ShowAlerts> true </a:ShowAlerts> <a:UserName/> </a:General> <a:Logging> <a:FileSplitMode>Never</a:FileSplitMode> <a:Folder> C:\ProgramData\QlikTech\QlikViewServer </a:Folder> <a:Level> <a:EnableEventLogging> true </a:EnableEventLogging> <a:EnablePerformanceLogging> true </a:EnablePerformanceLogging> <a:EnableSessionLogging> true </a:EnableSessionLogging> <a:PerformanceLoggingInterval> 5 </a:PerformanceLoggingInterval> </a:Level> <a:Verbosity>Low</a:Verbosity> </a:Logging> <a:Performance> <a:CPU> <a:Affinity xmlns:b="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <b:boolean> true </b:boolean> <b:boolean> true </b:boolean> </a:Affinity> <a:Throttle> 0 </a:Throttle> </a:CPU> <a:Document> <a:AllowDocumentAutoLoad> true </a:AllowDocumentAutoLoad> <a:MaxChartSymbols> 100 </a:MaxChartSymbols> <a:ObjectCalculationTimeLimit> 60 </a:ObjectCalculationTimeLimit> </a:Document> <a:Sessions> <a:ConcurrentSessionsTimeout> 1800 </a:ConcurrentSessionsTimeout> <a:MaxConcurrentSessions> 5000 </a:MaxConcurrentSessions> <a:MaxInactiveSessionTime> 1800 </a:MaxInactiveSessionTime> <a:MaxTotalSessionTime> 0 </a:MaxTotalSessionTime> </a:Sessions> <a:WorkingSetMemory> <a:HighLimit> 90 </a:HighLimit> <a:LowLimit> 70 </a:LowLimit> </a:WorkingSetMemory> </a:Performance> <a:QVSID> 5089db7b-0501-4b6d-b513-ee0c89107270 </a:QVSID> <a:Scope>All</a:Scope> <a:Security> <a:AllowAlternateAdmin> false </a:AllowAlternateAdmin> <a:AllowDynamicUpdate> false </a:AllowDynamicUpdate> <a:AllowExtensions> true </a:AllowExtensions> <a:AllowServerMacroExecution> true </a:AllowServerMacroExecution> <a:AllowServerSystemAccessMacroExecution> false </a:AllowServerSystemAccessMacroExecution> <a:Authentication> <a:Level>AllowAnonymous</a:Level> <a:UseDomainAccountForAnonymous> false </a:UseDomainAccountForAnonymous> </a:Authentication> <a:Authorization> <a:UseDMSAuthorization> true </a:UseDMSAuthorization> </a:Authorization> <a:CompressNetworkTraffic> true </a:CompressNetworkTraffic> <a:EnableAuditLogging>None</a:EnableAuditLogging> <a:EnableHTTPPush> false </a:EnableHTTPPush> <a:ExtensionsFolder/> </a:Security> </qvsSettings> </SaveQVSSettings> </s:Body> </s:Envelope> ' $res = Invoke-WebRequest -Uri $url -Method Post -Body $body -UseDefaultCredential -Headers $hdrs ##Display result $res
To get the list of API Calls you can perform, please have a look at:
For IQMS: IQMS Interface
For IQMS2: IQMS2 Interface