Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
HI All
Would like to start using the NPrinting API - in my case I would be calling it from PowerShell scripts
I've read lots of stuff on the net and Qlik forums and have got so far but now a little stuck
In the example below I'm wanting to run an NPrinting task based on the ID
The first section I authenticate and get cookie, then I Extract XSRF token from cookie, I then try to execute the NPrinting task.
# Authenticate and get cookie
$url = "https://nprinting.corp.ourdomain.com:4993/api/v1/login/ntlm"
Invoke-RestMethod -UseDefaultCredentials -Uri $url -Method Get -Headers $hdrs -SessionVariable websession
$cookies = $websession.Cookies.GetCookies($url)
$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession
$session.Cookies.Add($cookies);
# Extract XSRF token from cookie
$xsrf_token = $($cookies | Where-Object {$_.Name -eq "NPWEBCONSOLE_XSRF-TOKEN"}).Value
# Execute NPrinting task
$taskid = 'abd2531c-60e3-4057-917a-b1dd3730c1ed'
$url = "https://nprinting.corp.ourdomain.com:4993/api/v1/tasks/$($taskid)/executions"
Invoke-RestMethod -WebSession $session -Uri $url -Method Post -Headers $hdrs
I'm getting a "403 message stating user has no rights"
Invoke-RestMethod : {"code":403,"message":"User has no rights to access the resource"}
At line:14 char:1
+ Invoke-RestMethod -WebSession $session -Uri $url -Method Post -Header ...
My user account has admin role on NPrinting so not sure what else to check?
We are running NPrinting May 2022 SR4 and Qlik Sense Enterprise Feb 2022
Any ideas or suggestions appreciated
Paul
Hi @sturmeyp
Check that you have added your 'origin qlik sense or qlikview server' to the trusted origins setting on the NP web console under Admin>Settings>On Demand/Add Trusted Origin
Check this and other points mentioned here:
Kind regards...
Hi @sturmeyp
Check that you have added your 'origin qlik sense or qlikview server' to the trusted origins setting on the NP web console under Admin>Settings>On Demand/Add Trusted Origin
Check this and other points mentioned here:
Kind regards...
to follow up on Franks idea - the origin will be the machine you are trying to run your api call from