Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Hatus
Partner - Creator II
Partner - Creator II

NPrinting API method Connection

Hi,

 

I need to update a NPrinting Connection using its API in a Qlik Sense script. I use all the parameters as that the API needs, however it is not working.
Do you have an example how the call should look like? It seems on the dev tools in Chrome that other parameters are being used when I change the  NPrinting connection manually. 

I cannot find anything in the Qlik community so far. 

 

Kind regards

Hatus

Labels (2)
1 Solution

Accepted Solutions
Frank_S
Support
Support

Hi @Hatus 
Looks like you were very close.

You need to remove [ ] from your code.

Here is what I got back from my team...

let vConnectionBody =  chr(39) & '{"id":"' & vConnectionId 
& '","QlikSenseConnection":{'
& '"proxyUrl":"' & vQlikSenseProxyUrl 
& '","appId":"' & vQlikSenseAppId 
& '","identity":"' & vQlikSenseIdentity 
& '","applyTheme":false'
& ',"applyUserSectionAccess":false'
& '}'
& ',"name":"' & vConnectionName 
& '","appId":"' & vConnectionAppId 
& '","source":"QlikSense"'
& ',"notificationsEnabled":true'
& '}' & chr(39);

 Kind regards...

Please remember hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

9 Replies
Ray_Strother
Support
Support

Hello ,
The below links should assist you in developing and troubleshooting Nprinting API calls.

1. Qlik NPrinting API reference

https://help.qlik.com/en-US/nprinting/May2022/Content/NPrinting/Extending/NPrinting-APIs-Reference-R...

2. How to use NPrinting APIs inside a Sense load script

https://community.qlik.com/cyjdu72974/attachments/cyjdu72974/qlik-support-knowledge-base/1237/1/NP%2...
Frank_S
Support
Support

Hi @Hatus 

Feel free to download the attached app that contains the reload code.

You'll need to follow this article to set up your rest connectors first.

Kind regards...

ps: publish task reload app included

Please remember hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Hatus
Partner - Creator II
Partner - Creator II
Author

Hi @Frank_S 

Thank you for the example. However in this case I already have build a whole NPrinting routine using the API. 

I am trying now to implement the put /connections/{id} method. 

Qlik NPrinting API − put /connections/{id} | Qlik NPrinting Help

The body of the request using 

DataConnectionRequest:

Qlik NPrinting API − DataConnectionRequest | Qlik NPrinting Help

and QlikSenseConnection:

 Qlik NPrinting API − QlikSenseConnection | Qlik NPrinting Help

is returning bad request.

Do you have an example of a working put /connections/{id} request?

 

Thank you for your support!

 

Regards

Hatus

Frank_S
Support
Support

Hi @Hatus 

I've asked around here but I will need to know exactly what you are trying to do with

 

"put /connections/{id} "

 

Are you trying to 

  • change the name of the Connection name, 
  • Server address path to QS virtual proxy?
  • or other?

Descriptive Snapshots of the NP Connection fields in the NP web console/connections page that you are trying to update with the NP APIs available would be helpful as well.

Let me know and I will re-ask my team..thanks!

Please remember hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Hatus
Partner - Creator II
Partner - Creator II
Author

Hi @Frank_S 

 

I am trying to change the ID of the Qlik Sense app in the NPrinting connection. 

It means the "appId" under "QlikSenseConnection"

Here how I build the request body:

let vConnectionBody =  chr(39) & '{"id":' & vConnectionId 
& ',"QlikSenseConnection":[{'
& '"proxyUrl":' & vQlikSenseProxyUrl 
& ',"appId":' & vQlikSenseAppId 
& ',"identity":' & vQlikSenseIdentity 
& ',"applyTheme":false'
& ',"applyUserSectionAccess":false'
& '}]'
& ',"name":' & vConnectionName 
& ',"appId":' & vConnectionAppId 
& ',"source":"QlikSense"'
& ',"notificationsEnabled":true'
& '}' & chr(39);
Frank_S
Support
Support

Hi @Hatus 
Looks like you were very close.

You need to remove [ ] from your code.

Here is what I got back from my team...

let vConnectionBody =  chr(39) & '{"id":"' & vConnectionId 
& '","QlikSenseConnection":{'
& '"proxyUrl":"' & vQlikSenseProxyUrl 
& '","appId":"' & vQlikSenseAppId 
& '","identity":"' & vQlikSenseIdentity 
& '","applyTheme":false'
& ',"applyUserSectionAccess":false'
& '}'
& ',"name":"' & vConnectionName 
& '","appId":"' & vConnectionAppId 
& '","source":"QlikSense"'
& ',"notificationsEnabled":true'
& '}' & chr(39);

 Kind regards...

Please remember hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Frank_S
Support
Support

Hi @Hatus 

Also check out this link for tips on configuring your requirements.

For this case you need a POST connection and add 

 

HTTPHEADER "X-HTTP-Method-Override" "PUT" 

 

in the script as in the update user example in the guide.

https://community.qlik.com/t5/Qlik-NPrinting/How-to-use-Qlik-NPrinting-APIs-inside-a-Qlik-Sense-load...

 

 

 

Please remember hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Hatus
Partner - Creator II
Partner - Creator II
Author

Hi @Frank_S 

 

It works! Perfect, those brackets where really not needed 😅

 

Thank you very much once again.

Kind regards

Frank_S
Support
Support

Great news @Hatus !
Please mark the solution as accepted using the Accept as Solution button...Thanks!

Please remember hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!