Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
dmnab1
Contributor II
Contributor II

Getting app object metadata via REST API in Qlik Cloud

Hi,

In the company that I work at, we've got many extensions and I want to get rid of most of them. To do that, I'd need first to check which dashboards they are used in.

I couldn't find it in https://qlik.dev/apis/rest/

 I've seen there's an application "Extension Usage Dashboard-master" but unfortunately doesn't seem to be compatible with Qlik Cloud

Any clue? Thank you

Labels (2)
1 Solution

Accepted Solutions
Daniel_Pilla
Employee
Employee

Hi @dmnab1 ,

This is a great question, and one that is a bit nuanced and evolving. Here is some information:

  • Object metadata is not yet available RESTfully. This is in active development, but is not yet there. Being able to RESTfully get and set scripts was phase 1 and that has been implemented.
  • Object metadata can be fetched via the Engine, and there are many ways of doing that (Qlik Application Automation, Qlik CLI, Enigma.js, etc). These vary in complexity and there are caveats to how some operate (e.g., QAA can only open applications with data).
  • Private sheet metadata is currently only available to the owner of the sheet in Qlik Cloud. This is also changing very soon. There will be a method in fetching all sheet metadata from the engine in the very near future without having to impersonate users.

 

Option 1:

With all of the above said, the most user-friendly way of getting this data is through using QAA. I have attached a sample automation that loops through each sheet (public, community, and private that you own) and lists out the object types and owners, etc. You do not want to do this for all applications on the tenant as currently QAA can only open apps with data. To use it, create a new automation, provide a name, right-click in the canvas area, and select "Upload workspace".

flow.png

Just enter in an App Id and it will do the rest for you.

Option 2:

To scan everything in the tenant (because we can open the apps without data) you can use the Qlik-CLI. Again, this will be missing private content owned by other users for now (coming very soon). Here is an example snippet that will iterate through every app on the tenant and return all object titles, IDs, types, and whether they are a master object (including the underlying type).

 

$filePath = "C:\Test\metadata.csv";

New-Item -path $filePath -type "file" -Force
$header = 'Object Title,Object Type,Object ID,App ID,Is Master Object';
Set-Content $filePath -Value $header;
$apps = qlik app ls --limit 99999 --json | ConvertFrom-Json;
foreach ($app in $apps) {
    $metadata = New-Object System.Collections.ArrayList;
    $tempMetadata = qlik app object ls -a $app.resourceId --no-data --json | ConvertFrom-Json;
    foreach ($object in $tempMetadata) {
        if (!@('LoadModel', 'sheet', 'appprops').contains($object.qType)) {
            $objectMetadata = @{};
            $objectMetadata | Add-Member -Name appId -Value $app.resourceId -MemberType NoteProperty;
            $objectMetadata | Add-Member -Name isMasterObject -Value 0 -MemberType NoteProperty;
            if ($object.qType -eq "masterobject") {
                $objectType = (qlik app object properties -a $app.resourceId $object.qId --no-data --json | ConvertFrom-Json).visualization;
                $objectMetadata['qType'] = $objectType;
                $objectMetadata['isMasterObject'] = 1;
            }
            else {
                $objectMetadata['qType'] = $object.qType;
            }
            $objectMetadata['objectId'] = $object.qId;
            $objectMetadata['objectTitle'] = $object.title;
            $metadata.add($objectMetadata) | Out-Null;
        }
    }
    $metadata | ConvertTo-Csv | Select-Object -Skip 1 | Out-File -Append $filePath;
}

 

Which will yield something like the below:

Object Title Object Type Object ID App ID Is Master Object
 My Listbox listbox 12c4cf53-e2e9-44d7-82f7-105ac4ba9716 0c3c8b42-5211-486a-9170-16bf7c6f7874 0
 My Line Chart linechart 16ed0a5b-b0de-4e5c-ba50-0bfa46a2b8bf 0c3c8b42-5211-486a-9170-16bf7c6f7874 0
 My Listbox listbox 29cda91c-07e6-4019-919d-ac193b8acefd 0c3c8b42-5211-486a-9170-16bf7c6f7874 0
 My Line Chart linechart 2a01f1e5-996a-4eac-8591-5257d9a0bfb8 0c3c8b42-5211-486a-9170-16bf7c6f7874 0
 My KPI kpi 31ce1f9a-b470-44e4-942b-db4ae2ba3679 0c3c8b42-5211-486a-9170-16bf7c6f7874 0
My Line Chart linechart 35421fac-ef16-40df-9354-150edd28a34f 0c3c8b42-5211-486a-9170-16bf7c6f7874 1

 

Again, this is a changing landscape in Qlik Cloud, so stay tuned for updates.

Cheers,

View solution in original post

8 Replies
Daniel_Pilla
Employee
Employee

Hi @dmnab1 ,

This is a great question, and one that is a bit nuanced and evolving. Here is some information:

  • Object metadata is not yet available RESTfully. This is in active development, but is not yet there. Being able to RESTfully get and set scripts was phase 1 and that has been implemented.
  • Object metadata can be fetched via the Engine, and there are many ways of doing that (Qlik Application Automation, Qlik CLI, Enigma.js, etc). These vary in complexity and there are caveats to how some operate (e.g., QAA can only open applications with data).
  • Private sheet metadata is currently only available to the owner of the sheet in Qlik Cloud. This is also changing very soon. There will be a method in fetching all sheet metadata from the engine in the very near future without having to impersonate users.

 

Option 1:

With all of the above said, the most user-friendly way of getting this data is through using QAA. I have attached a sample automation that loops through each sheet (public, community, and private that you own) and lists out the object types and owners, etc. You do not want to do this for all applications on the tenant as currently QAA can only open apps with data. To use it, create a new automation, provide a name, right-click in the canvas area, and select "Upload workspace".

flow.png

Just enter in an App Id and it will do the rest for you.

Option 2:

To scan everything in the tenant (because we can open the apps without data) you can use the Qlik-CLI. Again, this will be missing private content owned by other users for now (coming very soon). Here is an example snippet that will iterate through every app on the tenant and return all object titles, IDs, types, and whether they are a master object (including the underlying type).

 

$filePath = "C:\Test\metadata.csv";

New-Item -path $filePath -type "file" -Force
$header = 'Object Title,Object Type,Object ID,App ID,Is Master Object';
Set-Content $filePath -Value $header;
$apps = qlik app ls --limit 99999 --json | ConvertFrom-Json;
foreach ($app in $apps) {
    $metadata = New-Object System.Collections.ArrayList;
    $tempMetadata = qlik app object ls -a $app.resourceId --no-data --json | ConvertFrom-Json;
    foreach ($object in $tempMetadata) {
        if (!@('LoadModel', 'sheet', 'appprops').contains($object.qType)) {
            $objectMetadata = @{};
            $objectMetadata | Add-Member -Name appId -Value $app.resourceId -MemberType NoteProperty;
            $objectMetadata | Add-Member -Name isMasterObject -Value 0 -MemberType NoteProperty;
            if ($object.qType -eq "masterobject") {
                $objectType = (qlik app object properties -a $app.resourceId $object.qId --no-data --json | ConvertFrom-Json).visualization;
                $objectMetadata['qType'] = $objectType;
                $objectMetadata['isMasterObject'] = 1;
            }
            else {
                $objectMetadata['qType'] = $object.qType;
            }
            $objectMetadata['objectId'] = $object.qId;
            $objectMetadata['objectTitle'] = $object.title;
            $metadata.add($objectMetadata) | Out-Null;
        }
    }
    $metadata | ConvertTo-Csv | Select-Object -Skip 1 | Out-File -Append $filePath;
}

 

Which will yield something like the below:

Object Title Object Type Object ID App ID Is Master Object
 My Listbox listbox 12c4cf53-e2e9-44d7-82f7-105ac4ba9716 0c3c8b42-5211-486a-9170-16bf7c6f7874 0
 My Line Chart linechart 16ed0a5b-b0de-4e5c-ba50-0bfa46a2b8bf 0c3c8b42-5211-486a-9170-16bf7c6f7874 0
 My Listbox listbox 29cda91c-07e6-4019-919d-ac193b8acefd 0c3c8b42-5211-486a-9170-16bf7c6f7874 0
 My Line Chart linechart 2a01f1e5-996a-4eac-8591-5257d9a0bfb8 0c3c8b42-5211-486a-9170-16bf7c6f7874 0
 My KPI kpi 31ce1f9a-b470-44e4-942b-db4ae2ba3679 0c3c8b42-5211-486a-9170-16bf7c6f7874 0
My Line Chart linechart 35421fac-ef16-40df-9354-150edd28a34f 0c3c8b42-5211-486a-9170-16bf7c6f7874 1

 

Again, this is a changing landscape in Qlik Cloud, so stay tuned for updates.

Cheers,

dmnab1
Contributor II
Contributor II
Author

That's what I was looking for! Thanks @Daniel_Pilla for sharing it

psublue98
Creator
Creator

Hi @Daniel_Pilla - I tried option 2 and tested for a single app but get this output in the csv. Is there something I'm missing? 

psublue98_0-1706651086072.png

 

Daniel_Pilla
Employee
Employee

Hi @psublue98 ,

What version of PS are you running? The above was built and tested on 7.3.11. I would also add in some logging and breaks to see what is happening along the way and where it breaks.

Cheers,

psublue98
Creator
Creator

Thanks Daniel, certainly closer using 7.4.1. The title isn't coming across though...

psublue98_0-1706723153429.png

 

TcnCunha_M
Creator II
Creator II

Hello @Daniel_Pilla  Does that "very soon " has arrived?
Because i want migrate from one Tenant to other i facing the issue of Private content not getting

As you think, so shall you become.
Daniel_Pilla
Employee
Employee

Hi @TcnCunha_M - yes, this is now possible. You can list all sheets within an application using OAuth and the required scopes. You can find a guide on how to do that with Qlik-API here: https://qlik.dev/manage/platform-operations/private-content-bots/ -- For use with the CLI, follow the same steps to setup the OAuth client, and then connect the Qlik-CLI via OAuth.

Hope this helps!

Cheers,

TcnCunha_M
Creator II
Creator II

about he bookmarks work in the same way ?

As you think, so shall you become.