Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
BuTbka
Creator
Creator

QlikView API get triggers for external program task

Hi!
Though API I can get only triggers for Document Task by GetDocumentTask 
How I can do the same for External Program Task?

Labels (1)
  • API

7 Replies
Benoit_C
Support
Support

Hi @BuTbka,

Maybe you could try with GetExternalProgramTask:

https://help.qlik.com/en-US/qlikview-developer/May2022/Subsystems/QMSAPIref/Content/PIX.Services.V12...

You could try something like:

 

Set objTask = objQlikViewServer.GetExternalProgramTask("TaskName")

 

 If Not objTask Is Nothing Then  

For Each objTrigger In objTask.Triggers    

' Do something with the trigger  

Next 

Else  

' Handle the case where the task was not found 
End If

In this proposal, objQlikViewServer is an instance of the QlikViewServer class, and TaskName is the name of the External Program Task that you want to retrieve information about. The method returns a reference to the Task object, which you can use to access its properties and methods.

Regards,

Benoit

BuTbka
Creator
Creator
Author

@Benoit_C Thanks!

But I'm trying to use an API from an external program in Visual Studio.
I can't use this method - see my comment below the article https://community.qlik.com/t5/Official-Support-Articles/QlikView-Connect-to-QMS-API-with-Visual-Stud...  

Benoit_C
Support
Support

Hi @BuTbka,

You could try to build a C command within Visual Studio using QMS Api.

Not sure it would work but you can try this below command, it could show how to retrieve a list of all External Program Tasks in a QlikView server:

using System;
using System.Collections.Generic;
using QMSAPI;

namespace QlikView_API_Example
{
    class Program
    {
        static void Main(string[] args)
        {
            // Connect to the QlikView server
            QMSClient client = new QMSClient("https://qlikview-server:4799/QMS/Service");

            // Get a list of all External Program Tasks
            List<ExternalProgramTask> tasks = client.GetExternalProgramTasks();

            // Display the name and ID of each task
            foreach (ExternalProgramTask task in tasks)
            {
                Console.WriteLine("Task Name: " + task.Name);
                Console.WriteLine("Task ID: " + task.ID);
                Console.WriteLine();
            }

            // Disconnect from the QlikView server
            client.Dispose();
        }
    }
}

 

This code would uses the QMS API to connect to the QlikView server and retrieve a list of all External Program Tasks. The tasks are represented by the 'ExternalProgramTask' class, which contains information such as the name and ID of the task.

Note: Maybe you will need to add a reference to the 'QMSAPI.dll' assembly in your Visual Studio project in order to use the QMS API. You can find this assembly in the '\Program Files\QlikView\Server\QMS' directory on your QlikView server.


 

BuTbka
Creator
Creator
Author

@Benoit_C thanks!
I will try.
I also tried in powershell

 

$url = "http://qlikview:4799/QMS/Service" 

$service = New-WebServiceProxy -Uri $url -Namespace QlikViewServer -UseDefaultCredential
$serviceKey = $service.GetTimeLimitedServiceKey()

$qdsID = 'b01df110-bc40-48d2-8173-07da9677f273'
$taskID = 'c22fa0f8-ae97-42bc-ad1e-70076c908c4a'

$hdrs = @{}
$hdrs.Add("SOAPACTION","http://ws.qliktech.com/QMS/12/7/IQMS7/GetExternalProgramTask")
$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>
<GetExternalProgramTask xmlns="http://ws.qliktech.com/QMS/12/7/">
<qdsID>' + $qdsID + '</qdsID>
<taskID>' + $taskID + '</taskID>
</GetExternalProgramTask>
</s:Body>
</s:Envelope>'

Invoke-WebRequest -Uri $url -Method Post -Body $body -UseDefaultCredential -Headers $hdrs -ContentType "text/xml;charset=utf-8"

 

and receive error:
The message with Action 'http://ws.qliktech.com/QMS/12/7/IQMS7/GetExternalProgramTask' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None)

with run task work well

 

$hdrs = @{}
$hdrs.Add("SOAPACTION","http://ws.qliktech.com/QMS/12/7/IQMS7/RunTask")
$hdrs.Add("Content-Type", "text/xml;charset=utf-8")
$hdrs.Add('X-Service-Key',$serviceKey)

$body = '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<RunTask xmlns="http://ws.qliktech.com/QMS/12/7/">
<taskID>' + $taskID + '</taskID>
</RunTask>
</s:Body>
</s:Envelope>'

 

pkeertipati
Contributor
Contributor

Is this working for you? I'm in a similar situation where I need some of these APIs in visual studio.

BuTbka
Creator
Creator
Author

Hi @pkeertipati !

No, it is a bug. If you can - open a support case.
There are a lot of missing(not exposed) methods in QMSAPI.
https://github.com/QlikProfessionalServices/QlikView-CLI/issues/4
https://github.com/QlikProfessionalServices/QlikView-CLI/issues/5


michael64
Contributor
Contributor

QlikView provides an API called the QlikView Management API that allows you to interact with QlikView Server and manage various aspects of the QlikView environment, including tasks and triggers. If you want to retrieve triggers for an external program task using the QlikView API, you would typically follow these steps:

https://github.com/QlikProfessionalServices/QlikView-CLI/issues/4
https://github.com/QlikProfessionalServices/QlikView-CLI/issues/5

https://www.dmdesign.com/kitchens/aberdeen-showroom/

  1. Authentication and Connection: Connect to your QlikView Server using the QlikView Management API. You will need to provide authentication credentials to establish a connection.

  2. Retrieve Task Information: Use the API methods to retrieve information about the specific task you're interested in. This might involve providing the task ID or task name as a parameter.

  3. Retrieve Triggers: Once you have the task information, you can use API methods to retrieve details about the triggers associated with that task. Triggers define the conditions under which a task should be executed.