Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
manoj2102
Contributor III
Contributor III

Executing Curl Command in Qlik Sense

Hello All,

I'm using Rest Connector to connect to API URL to pull data from Splunk System in Qlik Sense

Now its 3 step Process

1) Invoke Saved Search report using curl command

  curl -k -u username:password https://Server Address.



2) After execution the output is

  <response><sid>tuser__aaaa__dcreports_abc11111111c44440_at_123232324_63563636</sid> </response>

everyday new SID is generated.



3) then the final URL needs to be created using above <Sid> to refresh latest data.



Now in rest URL I have used  to get new URL daily from variable by using

WITH CONNECTION (

  URL "$(vURL)"


and

let vURL = 'https://abc.in.com/v3/surveys/$(vSID)/results --get -d output_mode=csv';

I want to know how to execute first two steps in Qliksense to execute curl command and get New SID every day so that I can update VURL daily  using variable(vSID) as shown above in sample URL .

Regards

Manoj Deshmane

 

 

1 Reply
Kalmer
Partner - Creator
Partner - Creator

Struggling to find a cURL example myself.

I can easily modify a connector in QS using one or all of the following:
WITH CONNECTION, QUERY, HEADER and pagation, but so far there are only a few examples to be found (except for the youtube vid where they connect to the easiest datalake to be found - starwars themed).

 


1) So i would suggest you to get the Api KEY with a POST method where you define your username and password to get the API key and move forward from there (IF your API supports POST method or is a SPoT API).
Example:
curl -X POST -H 'Content-Type: application/json' -d '{"email": "abc@def.com", "password": "12345678"}' https://xxx.xxx.xxx.xxx:9440/api/v1/api_keys.json

Picture of the connector:
Rest Post LIB example.Since the forum seems to be still a bit buggy (picture not appearing), i will leave a imgur picture here: https://imgur.com/a/UEE4opr

2) THAT means that if it is supported, then you will get your username and password to a RestConnectorMasterTable where you can read the data later;

example:
LET vPassword = peek('RestConnectorMasterTable', 0, 'apy-key')
LET vUsername = peek('RestConnectorMasterTable', 0, 'username')
LET vBodyPart = 'tuser_' & $(vUsername) & '_password_' & $(vPassword)  // or how ever the par of the WITH url body later should contain.
This is a mere example how i understood what the issue was in this case.
Hope it helps, i'm stuck with GETTING anything with cURL default method GET. It just wont let me validate my username and password while i'm creating the LIB since i'm supposed to skip the validation 🙂 (meaning i cannot TEST or CREATE the connection in the first place to use the parameters after, since QS won't allow you to save a not working LIB Connection).