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: 
sturmeyp
Contributor III
Contributor III

QlikNPrinting-CLI API (set value of a filter)

Hi Nprinting experts

I'm using the Qlik NPrinting CLI Powershell module 

My requirement is to call the API and set the value of a numeric filter
In this example the value I want to set is 12
the ID of the filter is 5af39708-f25f-4f58-91de-bcb8ceffa80b

My Connect-NPrinting command works so dont think there is issue there
However the rest of the command comes back with "bad request"
I think the syntax is completly wrong but I'm not sure where the error is
looking for someone who has maybe done this via powershell and can share some code

appreciate that QlikNPrinting-CLI is not fully supported by Qlik but thought I ask 

Connect-NPrinting -Computer https://servername -TrustAllCerts
$DataJSON = '12' |ConvertTo-Json
Invoke-NPRequest -method Put 'filters/5af39708-f25f-4f58-91de-bcb8ceffa80b' -Data $DataJSON

thanks
Paul

Labels (2)
1 Solution

Accepted Solutions
Ruggero_Piccoli
Support
Support

Hi,

Example of a valid body for the POST request /filters:

{
    "appId": "your app Id",
    "enabled": true,
    "name": "Created via API",
    "description": "Example of a filter created via API Postman",
    "fields": [
        {
            "connectionId": "your connection Id",
            "name": "Fiscal Year",
            "overrideValues": false,
            "selectExcluded": false,
            "values": [
                {
                    "value": "2013",
                    "type": "number"
                }
                ]
        }
                ],
   "variables": []
 }

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

1 Reply
Ruggero_Piccoli
Support
Support

Hi,

Example of a valid body for the POST request /filters:

{
    "appId": "your app Id",
    "enabled": true,
    "name": "Created via API",
    "description": "Example of a filter created via API Postman",
    "fields": [
        {
            "connectionId": "your connection Id",
            "name": "Fiscal Year",
            "overrideValues": false,
            "selectExcluded": false,
            "values": [
                {
                    "value": "2013",
                    "type": "number"
                }
                ]
        }
                ],
   "variables": []
 }

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.