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: 
covenant_bi
Creator
Creator

Using NPrinting API to disable publish tasks

We are looking to create a script using either REST API calls or the NPrinting CLI via powershell to disable any currently enabled Nprinting publish tasks. Many times we want to pause certain or all tasks due to data issues or downtime and we want to run this via a script.  Using the NP CLI we can use Get-NPTasks to retrieve the task but when trying to POST the change via Invoke-NPRequest, it doesn't take the -body parameter any longer, so this doesn't work

Invoke-NPRequest -method Post -path "tasks/publish/$($task.id)/executions" -body @{"enabled"="false"} |convertto-json -depth 10 (aware that enabled is a boolean and may need to be numeric)

Also when using -NPE and various combinations of the endpoint, it doesn't work either.  So my questions are:

Is it possible to enable/disable via API call?

Is there ANY documentation on NPE (even if you have to slide it under the table :))?

We are running NP May 2022 and the CLI 1.0.0.10

Labels (1)
2 Solutions

Accepted Solutions
covenant_bi
Creator
Creator
Author

@Ruggero_Piccoli @Frank_S 

 We do have a fair amount of our NPrinting jobs running via @Lech_Miszkiewicz  Qlik Sense API script.  So for all intents and purposes, we are controlling via QMC and calling the NP task when needed, which is usually a chained QMC task. We were trying to see if we could enable/disable the other non-QMC driven NP publish tasks, but it looks like we will just need to run them all via Lech's NP API script via QMC and then during downtime or disaster, everything is controlled via QMC and the NP console doesn't have any triggered tasks at all.  Thanks for the info though!

View solution in original post

Marc
Employee
Employee

The NPrinting-ToggleTasks.ps1 script can be used to toggle enable/disabled.

Also shows how you can use the NPrinting-CLI to GET the required object from the NPrinting API, make the relevant changes, and PUT the changes back to the server.

 

 

View solution in original post

5 Replies
Frank_S
Support
Support

Hello @covenant_bi 

 

(true) enabled

Try (false) disabled 

https://help.qlik.com/en-US/nprinting/May2022/APIs/NP+API/index.html?page=125

https://help.qlik.com/en-US/nprinting/May2022/APIs/NP+API/index.html?page=127#TaskExecutions

 

To accurately set up your rest connection, follow:

How to create NPrinting GET and POST REST connecti... - Qlik Community - 1832298

 

I have never tested this but give it a shot!

If you're not a programmer, ask a member of your team who is to have a look at this api to write the code.

 

Kind regards....

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

Hi,

Qlik NPrinting REST APIs allows to retrieve Tasks informations and run Task Executions but there is not an API that allows you to change parameters of existing tasks or that allows you to create tasks. For example, you cannot change the Enable flag via APIs or add recipients or filters. 

You could change the approach. You could create the tasks enabled and not set triggers for them and use API to run task executions when needed https://help.qlik.com/en-US/nprinting/May2022/APIs/NP+API/index.html?page=57

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.
covenant_bi
Creator
Creator
Author

@Ruggero_Piccoli @Frank_S 

 We do have a fair amount of our NPrinting jobs running via @Lech_Miszkiewicz  Qlik Sense API script.  So for all intents and purposes, we are controlling via QMC and calling the NP task when needed, which is usually a chained QMC task. We were trying to see if we could enable/disable the other non-QMC driven NP publish tasks, but it looks like we will just need to run them all via Lech's NP API script via QMC and then during downtime or disaster, everything is controlled via QMC and the NP console doesn't have any triggered tasks at all.  Thanks for the info though!

Marc
Employee
Employee

The NPrinting-ToggleTasks.ps1 script can be used to toggle enable/disabled.

Also shows how you can use the NPrinting-CLI to GET the required object from the NPrinting API, make the relevant changes, and PUT the changes back to the server.

 

 

covenant_bi
Creator
Creator
Author

Thanks Marc.  Fantastic stuff, as always!