Skip to main content
Announcements
Defect acknowledgement with Nprinting Engine May 2022 SR2, please READ HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
TusharDev_Qlik
Creator II
Creator II

Could not import or export report using NPrinting API

Hi Qlik Team,

We have 2 environments(UAT and Prod)  for our Nprinting and we wanted to automate NP deployment.

We are trying to export report zip from UAT and export the same in Production.

Version: May 2022

We are using Windows PowerShell to make API calls.

Please help us with Qlik NP API commands or any alternate approaches .

Labels (1)
1 Solution

Accepted Solutions
Ruggero_Piccoli
Support
Support

Hi,

There is no API method to export and import report, so you cannot automate this task. Methods are documented in https://help.qlik.com/en-US/nprinting/May2022/APIs/NP+API/index.html?page=46#Reports 

Best Regards,

Ruggero



Best Regards,
Ruggero
---------------------------------------------
When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads with a LIKE if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads with LIKEs if you feel additional info is useful to others.

View solution in original post

4 Replies
Ruggero_Piccoli
Support
Support

Hi,

There is no API method to export and import report, so you cannot automate this task. Methods are documented in https://help.qlik.com/en-US/nprinting/May2022/APIs/NP+API/index.html?page=46#Reports 

Best Regards,

Ruggero



Best Regards,
Ruggero
---------------------------------------------
When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads with a LIKE if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads with LIKEs if you feel additional info is useful to others.
andregas
Partner - Creator II
Partner - Creator II

Hello @TusharDev_Qlik ,

I've found the following not documented APIs.
Export report

  • method = POST
  • url = /npe/reports/<report_id>/export
  • headers
    • 'Content-Type': 'application/json'
    • 'Content-Length': <the lenght of your body>
  • body
    { "password": null, "error": false }

Save the result as .zip

 

The import is very complicated, there are three steps.

Step 1

  • mehtod = POST
  • url = /npe/upload/report/import/<np_appid>
  • headers
    • 'Content-Type': 'multipart/form-data; boundary=--<boundarykey>
    • 'Content-Length': <leght of the body: headers of request + stream of zip + footer>
  • body = the stream of zip and other info. You should look for some documentation about multipart send with rest API

The call return an ID.

Step 2

  • method = POST
  • url = /npe/reports/import
  • headers
    • 'Content-Type': 'application/json'
    • 'Content-Length': <the lenght of your body>
  • body
    { "fileId": <upload_id obtained in the previous call>, "appId": <np_appid> }

The call return a "result"

Step 3

  • method = POST
  • url = /npe/reports/import/confirm
  • headers
    • 'Content-Type': 'application/json'
    • 'Content-Length': <the lenght of your body>
  • body = the stringify of the "result" JSON from the previous call

 

Notes:

  • The origin url must be match exactly an url insert into NPrinting on-demand whitelist.
  • This steps miss the import of the report filter, it needs some other steps that I don't find.
  • The name of report must be unique for every NP app ID, otherwise the api failed.

I hope you'll make it works.

Regards

 

TusharDev_Qlik
Creator II
Creator II
Author

@andregas Thank you for the steps.

Will try and let you know if any issues.

Ruggero_Piccoli
Support
Support

Hi,

Not documented API means it is not supported officially and can be changed or removed in the future and your investments in developing solutions will not work anymore. So you do it at your own risk. 

Best Regards,

Ruggero



Best Regards,
Ruggero
---------------------------------------------
When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads with a LIKE if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads with LIKEs if you feel additional info is useful to others.