We're excited to announce that we'll be partnering with Credly starting October 19th - see what this means and read the announcement blog here!

Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.

Alteryx workflows to trigger QlikSense Dashboard refresh

vepp
8 - Asteroid

Hello All,

 

We have Qliksense as a reporting tool and we would like to trigger Qliksense dashboard  via Alteryx but we are facing issues like certificates issues. Does anyone got successful with this ?

 

NOTE : We have java application and it can trigger Qliksense Dashboard  through Qlik sense API so there is no issues with Qliksense.

 

Out problem is Alteryx download tool while calling Api is not considering the system certificates.  How to enforce Alteryx to use the certificates installed in the machine?

 

Please help me.

 

Regards,

Vep

35 REPLIES 35
psyrio
9 - Comet

Hello,

 

I have the same need.

If you have a answer I take 🙂

 

Regards,

Psyrio

vepp
8 - Asteroid

@psyrio    So far based on my analysis, Qlik certifications has to be installed in Alteryx machine to call  Qlik API  but Download Tool does not have certifications feature so you cannot use Alteryx for triggering API using alteryx tools. Another thing I tried is to build some python code to call Qlik APIs (Triger from Command tool)  and I was able to connect API but failed to trigger any jobs in Qlik side. I could be due to Python issue. May be you can try that options. 

 

Please share your method if it works. I have been trying this for a long time.

vepp
8 - Asteroid

@psyrio , I was able to achieve it by using Python Tool.  You need to try it out on your machine.

Its not the best python code  but will do the work with little error handling.

 

 

from ayx import Alteryx
import requests
import pandas as pd
from pandas import DataFrame


requests.packages.urllib3.disable_warnings()
sourcedata = Alteryx.read("#1")

cert1=sourcedata.loc[0,'cert1']
cert2=sourcedata.loc[0,'cert2']
xrfkey=sourcedata.loc[0,'X-Qlik-xrfkey']
qlikuser=sourcedata.loc[0,'X-Qlik-User']
url=sourcedata.loc[0,'url']
taskname=sourcedata.loc[0,'taskname']
Alteryx.write(sourcedata,3)

headers = {'X-Qlik-xrfkey': xrfkey,
"Content-Type": "application/json",
"X-Qlik-User":qlikuser}

 

#################################
#cert = ('C:/Keys/client.pem', 'C:/Keys/client_key.pem')
cert=()
cert=(cert1,cert2)
print(cert)

#################################

url_long = url+":4242/qrs/task/start/synchronous/?xrfkey="+xrfkey+"&name="+taskname
print("url:"+url_long)
try:
df = pd.read_fwf(StringIO(url_long), header=None, widths=[0, 200], names=['URL_LONG', 'URL_LONG_VALUE'])
except:
pass
# Print the dataframe
try:
print(df)
except:
pass

try:
Alteryx.write(df, 2)
except:
pass


#################################
try:
resp = requests.post(url_long, headers=headers, verify=False, cert=cert)
#print(resp.json())
try:
value=resp.json()
except:
pass
#type(value)
try:
df = DataFrame(list(value.items()),columns = ['Value','TaskId'])
Alteryx.write(df, 1)
except:
StringData = StringIO("""Error;Event
Error;Unable to call Qliksense, please check the given details
""")

df = pd.read_csv(StringData, sep =";")

# Print the dataframe
print(df)
Alteryx.write(df, 1)
except (RuntimeError, TypeError, NameError,OSError):
print("2 Unable to call Qliksense, please check the given details")
StringData = StringIO("""Error;Event
Error;Unable to call Qliksense, please check the given details
""")

df = pd.read_csv(StringData, sep =";")

# Print the dataframe
print(df)
Alteryx.write(df, 1)

 

 

psyrio
9 - Comet

Hello @vepp ,

 

Thanks a lot for your help. 

I don't have use the Pyhton module of ALTERYX, how I can configure because when I try de copy your code into the In part of the Python modul and I replace with the good variables I have the message : 

ALTERYX01 - BML_5.png

 

Thanks a lot.


Regards,

Psyrio

vepp
8 - Asteroid

@psyrio  Ok, indentation screwed up.  Here is my nice macro (at least to me)i Hope it will be useful. If you give proper inputs then it will work. Tested with scheduler also, its fine there too. [Not tested with Gallery as it is not required for me]

psyrio
9 - Comet

@vepp Thanks for the workflow.

 

I have try but I have a message "2 Unable to call Qliksense, please check the given details" and the field URL_LONG is null it's normal ?

What you use for the URL ? The IP, the Hostname (MACHINENAME) or the full Hostname (MACHINENAME.DOMAIN.COM) ?

 

Thanks a lot.

vepp
8 - Asteroid

@psyrio  URL_LONG should have values.

 

My URL value is like  https://machinename.abc.a.xxx.com

 

URL_LONG should form something like this  below. 

 

https://machinename.abc.a.xxx.com:4242/qrs/task/start/synchronous/?xrfkey=abcdefghijkl&name=Alteryx_Trigger_Test

 

How are you accessing the QS application? The machine name or host name that comes in the URL should be used here.

vepp
8 - Asteroid

@psyrio 

 

Like below

 

https://machinename.domain.com

 

URL_LONG should not be NULL. It should have values.

psyrio
9 - Comet

I have test with https://machinename.domain.com and I have the same.

 

Maybe a problem in this part ? :

 

url_long = url+":4242/qrs/task/start/synchronous/?xrfkey="+xrfkey+"&name="+taskname
print("url:"+url_long)
try:
df = pd.read_fwf(StringIO(url_long), header=None, widths=[0, 200], names=['URL_LONG', 'URL_LONG_VALUE'])

 

URL_LONG is different of url_long no ?

Labels