top of page
  • Writer's pictureSofia Ng

Getting dashboards daily from Qlik Cloud

With products such as Tableau, Power BI, and Qlik and the proliferation of dashboards there was a decrease of emailed reports. Many may have thought that this would mark the end of daily extracts of reports being emailed across the enterprise. However, as the years have gone on emailing has certainly diminished but there is still a place for an extracted pdf. If this is something you or your team is doing daily or even weekly at the moment it is something which can be automated.


In this article we will show how to set up an automated pdf export out of Qlik Sense Cloud.

To extract the pdf an API key is needed to authenticate.


To set this up log in to the Qlik Sense Cloud management console.


Click generate new and fill in the details

Once the API key has been generated, we can authenticate against the API. In our example we will use a logic app top perform the actions however any other orchestrator which can send http calls should work as well.

The first call to make is a POST to https://{ your url }.{ location }.qlikcloud.com/api/v1/reports. In authorization is handled in the header.


Now comes the exciting piece, the request body.


This first part specifies that we will be exporting to pdf

{

"type": "composition-1.0",

"output": {

"type": "pdfcomposition",

"outputId": "composition1",

"pdfCompositionOutput": {

"pdfOutputs": [


In our example we have 2 sheets we want to export, and these are setup to export as A4 centred in the page.

{

"size": "A4",

"align": {

"vertical": "middle",

"horizontal": "center"

},

"resizeType": "autofit",

"orientation": "A"

},

{

"size": "A4",

"align": {

"vertical": "middle",

"horizontal": "center"

},

"resizeType": "autofit",

"orientation": "A"

}

While many may use relative filters we may want to add selective filters to our dashboard export. This is done in the selectionsByState node. In this example we are filtering the Product Group to include only Produce.


"definitions": {

"selectionsByState": {

"sel1": {

"$": [

{

"values": [

{

"text": "Produce",

"isNumeric": false

}

],

"fieldName": "Product Group",

"defaultIsNumeric": false


The next part of the body requires us to collect some information from the browser. Specifically, the appId and the sheet Id. This can be collected from the url address, simply login to the cloud app and navigate to the sheet to be exported.


In the below image the blue highlighted box includes the section which calls out the appID, and the pink highlighted section calls out the sheet id.

Putting the appid and sheetid together with the selection


"compositionTemplates": [

{

"type": "sense-sheet-1.0",

"senseSheetTemplate": {

"appId": "80b02c10-1d08-4609-a601-77eb21a5f2d4",

"sheet": {

"id": "86c0d7d4-781e-427e-9fd4-f89124e34de5"

},

"selectionsByStateDef": "sel1"

}


Putting all of these sections together we have a full body call:


{

"type": "composition-1.0",

"output": {

"type": "pdfcomposition",

"outputId": "composition1",

"pdfCompositionOutput": {

"pdfOutputs": [

{

"size": "A4",

"align": {

"vertical": "middle",

"horizontal": "center"

},

"resizeType": "autofit",

"orientation": "A"

},

{

"size": "A4",

"align": {

"vertical": "middle",

"horizontal": "center"

},

"resizeType": "autofit",

"orientation": "A"

}

]

}

},

"definitions": {

"selectionsByState": {

"sel1": {

"$": [

{

"values": [

{

"text": "Produce",

"isNumeric": false

}

],

"fieldName": "Product Group",

"defaultIsNumeric": false

}

]

}

}

},

"compositionTemplates": [

{

"type": "sense-sheet-1.0",

"senseSheetTemplate": {

"appId": "80b02c10-1d08-4609-a601-77eb21a5f2d4",

"sheet": {

"id": "86c0d7d4-781e-427e-9fd4-f89124e34de5"

},

"selectionsByStateDef": "sel1"

}

},

{

"type": "sense-sheet-1.0",

"senseSheetTemplate": {

"appId": "80b02c10-1d08-4609-a601-77eb21a5f2d4",

"sheet": {

"id": "098eaf0a-8aa3-4d7d-8b1d-ac9cb017c2a7"

},

"selectionsByStateDef": "sel1"

}

}

] }


The response will be a status url which can be queried to retrieve the pdf content. This is accessed using the same authorization method.


We can then parse the result of the above call and for each response (should be one), we send a GET request to retrieve the content. The location url will follow a pattern similar to this: https://uqs3b3fp6hd68o3.ap.qlikcloud.com:443/api/v1/temp-contents/62fef93ba7f18f0001ecf7b7?inline https://{ your url }.{ location }.qlikcloud.com:443/api/v1/temp-contents/{GUID}?inline=1

Then we can simply create the blob

Now we can do anything we like with the resulting pdf



We can share it via a number of applications, pop it in Teams, send via email, anything you like.


Reach out to us on our contact us page or on linkedIn if you have any questions or would like to have a chat about how your business can benefit from automations such as these.



10 views
bottom of page