Skip to main content

QlikView QMS API: Get services status (PowerShell)

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
Damien_Villaret
Support
Support

QlikView QMS API: Get services status (PowerShell)

Last Update:

Aug 3, 2021 7:35:29 AM

Updated By:

Sonja_Bauernfeind

Created date:

Dec 6, 2019 3:37:27 AM

This article explains how to fetch services status using the QMS API with PowerShell.

 

Environment:

 

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 services IDs.

$hdrs = @{}
$hdrs.Add("SOAPACTION","http://ws.qliktech.com/QMS/12/2/IQMS2/GetServices")
$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>
<GetServices xmlns="http://ws.qliktech.com/QMS/12/2/">
<serviceTypes>All</serviceTypes>
</GetServices>
</s:Body>
</s:Envelope>'

$res = Invoke-WebRequest -Uri $url -Method Post -Body $body -UseDefaultCredential -Headers $hdrs

#Display result
$res.Content


In order to fetch services status, the following API call can be used, services ID must be passed in the body.

$hdrs = @{}
$hdrs.Add("SOAPACTION","http://ws.qliktech.com/QMS/12/2/IQMS2/GetServiceStatuses")
$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>
<GetServiceStatuses xmlns="http://ws.qliktech.com/QMS/12/2/">
<serviceIDs xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:guid>
f60820d9-da9d-4dba-904b-70adf5397b8b
</a:guid>
<a:guid>
ffef6257-7b01-4667-a5ce-ebdf66694e42
</a:guid>
</serviceIDs>
</GetServiceStatuses>
</s:Body>
</s:Envelope>'

$res = Invoke-WebRequest -Uri $url -Method Post -Body $body -UseDefaultCredential -Headers $hdrs
$res.Content


Note: For the QlikView Management Service (QMS), the status will only display "OK", for other services, further information such as "Running" will be displayed.
This is expected, in the case the QlikView Management Service is down the API call will just plainly fail as it is the service managing this API.


To get the list of API Calls you can perform, please have a look at: 

For IQMS:  IQMS Interface
For IQMS2: IQMS2 Interface

 

Labels (1)
Comments
CYRUS
Contributor III
Contributor III

Hello,

  I am trying to use GetTimeLimitedServiceKey in postman, when I sent the post request it doesnt fail but there is no response returned. its blank .

here is my configuration:

Qlik version: 12.5

Post Url: http://SERVERNAME:4799/QMS/Service

Autentication: BASIC (DOMAIN\USER, password)

Body:

<s:Body>
</GetTimeLimitedServiceKey>
</s:Body>
</s:Envelope>
 
but I did not receive any X-Service-Key .
Thank you

 

Sonja_Bauernfeind
Digital Support
Digital Support

Hello @CYRUS 

Please post your query in the dedicated Integration forum for QlikView to be able to make use of our active community and engineers monitoring the forum.

 

All the best,
Sonja 

Contributors
Version history
Last update:
‎2021-08-03 07:35 AM
Updated by: