Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Qlikers,
First at all I have to apologyze if I'm asking something too easy, at this moment it isn't for me. I'm trying to learn from zero how to use QS APIs and everything is new for me.
My goal is to create an external script in order to obtain a list of apps from my QS environment and for each one, I want to get the content that you can see via Data Load Editor, the reason is because I want to know the different data sources that any app is using (QVDs, Excel files, tables from any database, etc.).
I was able to do something similar developing a Qlik app but now I want to obtain this data via API. My first tests were using PowerShell. Let me show you my example:
$hdrs = @{}
$hdrs.Add("X-Qlik-xrfkey","12345678qwertyui")
$hdrs.Add("X-Qlik-User","UserDirectory=DOMAIN; UserId=USER1")
$cert = Get-ChildItem -Path "Cert:\CurrentUser\My" | Where {$_.Subject -like '*QlikClient*'}
$url = "https://QSHOST:4242/qrs/about?xrfkey=12345678qwertyui"
Invoke-RestMethod -Uri $url -Method Get -Headers $hdrs -Certificate $cert
It worked for me returning the output below:
The next step is to obtain the list of apps so I think that I need to change the method-type to POST, I mean something like that:
$body = '{
"UserDirectory": "DOMAIN",
"UserId": "USER1",
"Attributes": [
{
"name": "GETAPPLIST",
"handle": "-1",
"method": "GetDocList",
"params": []
}
]
}'
$hdrs = @{}
$hdrs.Add("X-Qlik-xrfkey","12345678qwertyui")
$hdrs.Add("X-Qlik-User","UserDirectory=DOMAIN;UserId=USER1")
$cert = Get-ChildItem -Path "Cert:\CurrentUser\My" | Where {$_.Subject -like '*QlikClient*'}
$url = "https://QSHOST:4242/qrs/about?xrfkey=12345678qwertyui"
Invoke-RestMethod -Uri $url -Method Post -Body $body -ContentType 'application/json' -Headers $hdrs -Certificate $cert
In this case the result I'm obtaining is the next below:
So, my questions are:
- Is it possible to do what I want via PowerShell? Can you show me any example? else what developing language you recommend me?
Thanks for your time 😉
I'm thinking that my fail was to think that any API service for Qlik could be queried by any solution and so far I have understood:
Please, can you confirm me if I'm right.
Thanks for your support
I'd say your first bullet is correct, but the second one is rather inaccurate. First of all, QPS typically refers to the Qlik Proxy Service (QRS refers to Qlik Repository Service). Both QRS and QPS APIs are based on REST:
Websockets on the other hand, are required to interact with the Engine API:
The use of websockets is not really tied to a particular technology, and in theory you should be able to use it from any language you want, but this API is somewhat more complicated than simply using REST, so having a library for interacting with it that takes care of the low level stuff highly simplifies things.
Mostly when working with APIs for the client managed version of Qlik Sense you will be interacting with the Repository API and/or the Engine API. The Repository API focuses on App environment like streams, owners, publish status etc, while the Engine API focuses on app contents like script, visualizations and bookmarks.
There is some overlap between the two (you can for instance change the title of an app from the QMC), but in general that is the distinction between the two.
Ok, thanks for making it more clear. So the summary could be if I want to work with the app content (script, lineage, ...) I have to play with the Engine API.
Knowing that I'm going to improve my knowledge of JS and to try to play with Engine API and Enigma.js.
Thanks a lot
Hi @LDR
As @Øystein_Kolsrud Engine API is the way to go, good thing is that code in .net C# can be used in PowerShell if you try to use/convert code from c#.
Just wanted to provide the URL for QRS API as I noticed the method you are attempting to use doesn't have a body, probably you were looking for the app/full endpoint https://help.qlik.com/en-US/sense-developer/August2022/APIs/RepositoryServiceAPI/index.html
The documentation to our Engine API is found here:
Hope it helps!