Click or drag to resize
IQMSGetServiceStatuses Method
Gets the status of all services which matches the provided list of service ID's.

Namespace: PIX.Services.V12
Assembly: 
Syntax
List<ServiceStatus> GetServiceStatuses(
	List<Guid> serviceIDs
)

Parameters

serviceIDs
Type: System.Collections.GenericListGuid
A list of service IDs.

Return Value

Type: ListServiceStatus
A list of statuses of all services with a matching ID.
Remarks
Security note Security Note

Requires membership of local group QlikView Management API.

Examples
The following example starts by retrieving a list of all QDS-services and then asks for their status.

The service key injection is assumed to be handled behind the scenes. For an example of how to inject the service key, see Samples.

C#
 using System;
 using System.Collections.Generic;
 using System.Linq;
 using QMSAPI;

class Program
{
     static void Main(string[] args)
     {
         try
         {
             // create a QMS API client
             IQMS apiClient = new QMSClient();

             //retrieve a time limited service key
             ServiceKeyClientMessageInspector.ServiceKey = apiClient.GetTimeLimitedServiceKey();

             // get a list of QDS services
             List<ServiceInfo> qdsServices = apiClient.GetServices(ServiceTypes.QlikViewDistributionService);
             if (qdsServices.Count > 0)
             {
                 //Get the service statuses of all the QDSs using their IDs
                 List<ServiceStatus> serviceStatuses = apiClient.GetServiceStatuses(qdsServices.Select(qdsService => qdsService.ID).ToList());

                 //Loop through all received statuses
                 foreach (ServiceStatus serviceStatus in serviceStatuses)
                 {
                 //Print the name of the service
                 Console.WriteLine(serviceStatus.Name);
                 //For all members, print the host they are executing on and their current status
                 serviceStatus.MemberStatusDetails.ForEach(serviceDetail => Console.WriteLine(serviceDetail.Host + ":" + serviceDetail.Status));
                 }
             }
         }
         catch (Exception ex)
         {
             Console.WriteLine("An exception occurred: " + ex.Message);
         }
         // wait for user to press any key
         Console.ReadLine();
     }
}
See Also