Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content
Announcements
Gartner® Magic Quadrant™: 15 YEARS A LEADER - GET THE REPORT
cancel
Showing results for 
Search instead for 
Did you mean: 
PabloLabbeImaps
Partner Ambassador
Partner Ambassador

Call Qlik Cloud Reporting Service API from an embedded sheet (self-service report generation) -updated

I'm working in a POC were i have a requirement to create a pixel-perfect report  and call it on-demand based on user selections in an embedded sheet. The sheet will be available to authenticated users on a custom authenticator provider. The app has section access.

Reviewing the documentation , haven't found any information about compatibility with section access  The only note is that is required to call the api using an authentication token and this token inherits the permission from the user it belongs. My assumption is correct ?

Also haven´t found much information or samples about using Reporting Service API to call a pixel-perfect template and generate a report.

So I'm looking for some answers about executing Reporting Service API on demand considering this scenario.

I'm also looking for some code snipets to call the API, check status of report generation and download the generated file, but didn´t found anything. Were can I found some examples ?

 

Thanks for helping !

 

Labels (3)
1 Solution

Accepted Solutions
DaveChannon
Employee
Employee

We have a backlog item to document this. It'll be an extension (or maybe, sibling?) of https://qlik.dev/embed/reports/qlik-api-export-data/

As for payload, the request you need looks like (update section 2.1.2):

curl -L "https://tenant.eu.qlikcloud.com/api/v1/reports" ^
-H "Authorization: Bearer <token>" ^
-H "Content-type: application/json" ^
-H "Accept: application/json" ^
-d "{
  \"type\": \"sense-pixel-perfect-template-1.0\",
  \"sensePixelPerfectTemplate\": {
    \"templateLocation\": {
      \"format\": \"url\",
      \"path\": \"/api/v1/report-templates/5b49a430-c782-4ec5-bbc2-6522d5a8263a\"
    },
    \"selectionChain\": [
      {
        \"selectionType\": \"temporaryBookmarkV2\",
        \"temporaryBookmarkV2\": {
          \"id\": \"Temporary\\49fa134e-a7bd-45d6-874c-a6fad16b47f7\"
        }
      }
    ]
  },
  \"meta\": {
    \"exportDeadline\": \"P0Y0M0DT1H0M0S\",
    \"tags\": [\"sense-ondemand.download\"]
  },
  \"output\": { \"outputId\": \"pdf_file\", \"type\": \"pdf\", \"pdfOutput\": {} }
}
"

 

So...a hybrid of the two. You can use https://qlik.dev/apis/rest/report-templates/ to list the templates available for the app by filtering on sourceAppId

View solution in original post

9 Replies
jochem_zw
Employee
Employee

Hi Pablo, maybe easy thinking, but why not Execute a Qlik Automation (by API) which will be doing the hard work for you?

PabloLabbeImaps
Partner Ambassador
Partner Ambassador
Author

Hi Jochem,  Qlik Automation only have blocks to create report based on in-app sheets and  I need to run a Pixel Perfect Report. 

I found some samples to run a report using directly Reporting Services API , but nothing for pixel perfect template.  https://qlik.dev/embed/reports/reporting-api-samples/

jochem_zw
Employee
Employee

thanks for updating with your original post with 'Pixel Perfect' reports, this changes things of course. I will try to contact a Product Manager, to see if the Pixel Perfect API's are already GA. 

jochem_zw
Employee
Employee

Hi Pablo,

The API to trigger report generation (which is used by the on-demand function within Qlik Cloud) https://qlik.dev/apis/rest/reports/#post-v1-reports should cover that, and https://qlik.dev/apis/rest/report-templates/ is for managing existing reports. Creating reports is something you have to do manually on the the tenant, there are no APIs for this. 

Think this is all you need. Sorry I don't have sample code.

PabloLabbeImaps
Partner Ambassador
Partner Ambassador
Author

Hi Jochem, the pixel perfect report will be created previously. No need to be created programmatically.

My request now will be a sample to create a request with the sense-pixel-perfect-template-1.0 type 

 

jochem_zw
Employee
Employee

I know, with generating I mean the report will be executed, just like a on demand from a App. So report needs to be manually generated and can be triggered (executed) with the API:

 https://qlik.dev/apis/rest/reports/#post-v1-reports

Like i said, sorry I don't have sample code for you...

DaveChannon
Employee
Employee

We have a backlog item to document this. It'll be an extension (or maybe, sibling?) of https://qlik.dev/embed/reports/qlik-api-export-data/

As for payload, the request you need looks like (update section 2.1.2):

curl -L "https://tenant.eu.qlikcloud.com/api/v1/reports" ^
-H "Authorization: Bearer <token>" ^
-H "Content-type: application/json" ^
-H "Accept: application/json" ^
-d "{
  \"type\": \"sense-pixel-perfect-template-1.0\",
  \"sensePixelPerfectTemplate\": {
    \"templateLocation\": {
      \"format\": \"url\",
      \"path\": \"/api/v1/report-templates/5b49a430-c782-4ec5-bbc2-6522d5a8263a\"
    },
    \"selectionChain\": [
      {
        \"selectionType\": \"temporaryBookmarkV2\",
        \"temporaryBookmarkV2\": {
          \"id\": \"Temporary\\49fa134e-a7bd-45d6-874c-a6fad16b47f7\"
        }
      }
    ]
  },
  \"meta\": {
    \"exportDeadline\": \"P0Y0M0DT1H0M0S\",
    \"tags\": [\"sense-ondemand.download\"]
  },
  \"output\": { \"outputId\": \"pdf_file\", \"type\": \"pdf\", \"pdfOutput\": {} }
}
"

 

So...a hybrid of the two. You can use https://qlik.dev/apis/rest/report-templates/ to list the templates available for the app by filtering on sourceAppId

PabloLabbeImaps
Partner Ambassador
Partner Ambassador
Author

Thanks @DaveChannon for this guide. I'll have a try.

PabloLabbeImaps
Partner Ambassador
Partner Ambassador
Author

After some testing and adjusts its working now ! Thanks @DaveChannon and  @jochem_zw !

Now I'm just figuring out how to create the temporary bookmark for selections.