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: 
pixlics12
Contributor III
Contributor III

How to get list of assigned Space / Fetch all Apps of an Space / Fetch all Sheets of an App using REST API

Hello all, I am working on a project, where I integrated Qlik by embedding the Qlik Apps and Sheets on my website. So the flow is like below:

  1. User comes to my site, logged in and authenticate with his Qlik account using OAuth, so I have the JWT token of the user.
  2. User first select a Space from the dropdown, this list generated using the API: Space REST.
  3. Then user select an App from another dropdown. These Apps are of previously selected Space and generated using the API: Apps REST.
  4. Now the user select a Sheet from another dropdown. These Sheets are of previously selected App and generated using the JS code: Handle sheets in iframes with enigma.js.
  5. When user select a Sheet, and click on the 'Load' button, then the related Sheet will render on the website.

It is working but there are some challenges, please check below points for query/issues:

  1. When I tried to list the Spaces, all of the Spaces are returning from the API. However on the Qlik I can see all these Spaces, but my Qlik user not assigned/selected in these Spaces. So basically I need only Spaces where the logged user is directly assigned/selected. Is it possible to do?
  2. I am able to view all these Spaces and Apps on the Qlik, but when I tried to embed them then it is not working. I can embed only those Apps where I am assigned in their Spaces.
    Following is the error I caught when tried to embed other Apps where I am not assigned in their Space.
    pixlics12_0-1711462734497.png
  3. Same issue with the Apps also. I need the all Apps of the selected Space only. So is there any filter available for the Apps by Space?
  4. Currently I am using JS code to list Sheet by App. So is there any API available to list Sheets by an App?

Also for the embedding part, I used following 2 article/question on Qlik community, may be helpful for someone:

  1. Enhanced Guide: Embedding Qlik Cloud Content with ... - Qlik Community - 2110735
  2. How to embed Qlik App/Sheet on the website - Qlik Community - 2423034

Can anyone please help me on this.

Thank You...

Labels (1)
4 Replies
njain
Contributor II
Contributor II

Hello Pixlics,

 

Can you please help me to logged in , authenticate and get apps for selected sapce.

 

Thanks in anticipation 

Looking forward for your reply.

pixlics12
Contributor III
Contributor III
Author

@njain please check below steps to create client on Qlik Management Console:

Log in to Qlik Account and Access Management Console

  • Log in to your Qlik account and navigate to the "Management Console".

    pixlics12_3-1712743510316.png

Copy the URL, which should be in this format: https://xxxxxxxxxxxxxxx.xx.qlikcloud.com/console/home

OAuth Client Configuration

  • From the left side menu, select "OAuth".
  • Click on the "Create new" button.

    pixlics12_0-1712743471517.png
  • In the "Create new OAuth client configuration" form:
    • Choose "Web" as "Client type."
    • Provide a unique "Name."
    • Under "Scopes," select the following permissions:
      • user_default
      • offline_access
      • admin.apps > admin.apps:read
      • apps > apps:read
    • Add the redirect URLs:
    • Check the "Allow Machine-to-Machine (M2M)" checkbox.
    • Copy the "Client ID" and "Client secret" from the next popup for later use.

      pixlics12_1-1712743471519.png
    • In the newly created app, edit the OAuth:
      • Change the "Consent method" to "Trusted…"
      • Click the "Change consent method" button.

        pixlics12_2-1712743471519.png

 

Now you have the Tenant URL, Client ID and Client secret.
Now hit below URL after set your data:
https://xxxxxxxxxxxxxxx.xx.qlikcloud.com/oauth/authorize?client_id=<client_id>grant_type=authorization_code&scope=user_default offline_access apps:read admin.apps:read&redirect_uri=https://example.com/api/v1/callback/qlik&state=<some data>

It will redirect you on Qlik to login. After successful login, will redirect on the URL which you set in the app and mentioned in the above URL "https://example.com/api/v1/callback/qlik" with a "code".

Now call /oauth/token to get the token. Have a look at following screenshot:

pixlics12_0-1712744087193.png

If everything is OK, you should receive a token.

Now use that token to get the app list by following API:

GET https://xxxxxxxxxxxxxxx.us.qlikcloud.com/api/v1/items?resourceType=app
GET https://xxxxxxxxxxxxxxx.us.qlikcloud.com/api/v1/apps

I think both APIs will work, take one which will suites you.

Have a nice day.

njain
Contributor II
Contributor II

What should I use for "Code" ?

pixlics12
Contributor III
Contributor III
Author

you can check my last reply for this. I mentioned there about "code".