<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: NPrinting API - Create Filter in Qlik NPrinting</title>
    <link>https://community.qlik.com/t5/Qlik-NPrinting/NPrinting-API-Create-Filter/m-p/1691909#M28561</link>
    <description>&lt;P&gt;Hi Ruggero,&lt;/P&gt;&lt;P&gt;We have Nprinting version September 2019, I selected 2017 by mistake&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vitalii&lt;/P&gt;</description>
    <pubDate>Wed, 08 Apr 2020 08:43:06 GMT</pubDate>
    <dc:creator>vitaliichupryna</dc:creator>
    <dc:date>2020-04-08T08:43:06Z</dc:date>
    <item>
      <title>NPrinting API - Create Filter</title>
      <link>https://community.qlik.com/t5/Qlik-NPrinting/NPrinting-API-Create-Filter/m-p/1691640#M28552</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to create Nprinting filters in Qliksense script, but each time I received error 400&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"One of the following errors has occurred:The body of the request is malformed.The app with the specified 'appId' does not exist.One or more connections does not belong to the app with the specified appId.The cache for one or more connection IDs is not in status "Generated".The connection does not contain a field with the specified name."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Based on the documentation I added to the filter's body appid, enabled and name, but issue still appers&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Could someone provide syntax of filter body?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thansk,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Vitalii&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Apr 2020 14:20:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-NPrinting/NPrinting-API-Create-Filter/m-p/1691640#M28552</guid>
      <dc:creator>vitaliichupryna</dc:creator>
      <dc:date>2020-04-07T14:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: NPrinting API - Create Filter</title>
      <link>https://community.qlik.com/t5/Qlik-NPrinting/NPrinting-API-Create-Filter/m-p/1691822#M28557</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Are you doing it from Qlik load script? Did you trace variable which gets passed as request BODY? I assume you are not passing APP ID or using wrong parameter for "Enabled".&lt;/P&gt;&lt;P&gt;As exercise I suggest you first hardcode your request by hardcoding NPrinting app id in table below. : This will create empty filter in the app.&lt;/P&gt;&lt;P&gt;I tested it in my environment so I am sure it works.&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;Let vURL_Filters =   'https://$(vNPrintingServer):4993/api/v1/filters';
Let vConnection_POST =   'Your Res POST Connection'; 
FiltersTable:
            Load
                RowNo()-1                                       as FilterRowNo,
                'API_Test'                                      as FilterName,
                '1637d2ed-a479-4afa-8900-c471f43e2eae'          as FilterAppId,
                True()                                          as FilterEnabled
            Autogenerate
                (1)
            ;
            
            FOR Each  vFilterRowId in FieldValueList('FilterRowNo'); 
            
                //  create Filter

                    LIB CONNECT TO '$(vConnection_POST)';
    
                    Let vFilterName     = CHR(34) &amp;amp; Peek('FilterName'            ,$(vFilterRowId),'FiltersTable') &amp;amp; CHR(34);
                    Let vFilterAppId    = CHR(34) &amp;amp; Peek('FilterAppId'           ,$(vFilterRowId),'FiltersTable') &amp;amp; CHR(34);
                    Let vFilterEnabled  = CHR(34) &amp;amp; Peek('FilterEnabled'         ,$(vFilterRowId),'FiltersTable') &amp;amp; CHR(34);

                //  create json BODY

                    set vFilterBody     = '{"Name":$(vFilterName),"AppId":$(vFilterAppId),"Enabled":$(vFilterEnabled)}';
                    Trace $(vFilterBody);
                    let vFilterBody     = replace(vFilterBody,'"', chr(34)&amp;amp;chr(34));
                    
                //  trigger request 

                    RestNPPOSTandPUTTestTable:
                    SQL SELECT
                        "__KEY_data"
                    FROM 
                        JSON (wrap off) "data" PK "__KEY_data"
                    WITH 
                        CONNECTION( URL "$(vURL_Filters)", BODY "$(vFilterBody)",
                        HTTPHEADER "Origin" "$(vQlikSenseServer)",
                        HTTPHEADER "Content-Type" "application/json",
                        HTTPHEADER "cookie" "$(vCookie)")
                    ;
                    
                    DROP TABLE RestNPPOSTandPUTTestTable;
                    
                    exit script;
                
            NEXT&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 01:59:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-NPrinting/NPrinting-API-Create-Filter/m-p/1691822#M28557</guid>
      <dc:creator>Lech_Miszkiewicz</dc:creator>
      <dc:date>2020-04-08T01:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: NPrinting API - Create Filter</title>
      <link>https://community.qlik.com/t5/Qlik-NPrinting/NPrinting-API-Create-Filter/m-p/1691823#M28558</link>
      <description>&lt;P&gt;one note - I am not sure about September 2017 version. It is very old and I did not test on it.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 02:00:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-NPrinting/NPrinting-API-Create-Filter/m-p/1691823#M28558</guid>
      <dc:creator>Lech_Miszkiewicz</dc:creator>
      <dc:date>2020-04-08T02:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: NPrinting API - Create Filter</title>
      <link>https://community.qlik.com/t5/Qlik-NPrinting/NPrinting-API-Create-Filter/m-p/1691896#M28559</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;In November 2019 we solved the following issue:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Changes to Filters APIs&lt;/STRONG&gt;&lt;BR /&gt;Changes to filters APIs:&lt;BR /&gt;- The field properties "selectExcluded" and "overrideValues" are optional with default value "false"&lt;BR /&gt;- The filter fields list is optional with an empty fields list as default value&lt;BR /&gt;- Set missing/required attribute on properties that were only marked as optional&lt;/P&gt;&lt;P&gt;So I think you are not setting a parameter documented as optional in the old September 2017 but instead it is mandatory.&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Ruggero&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 08:23:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-NPrinting/NPrinting-API-Create-Filter/m-p/1691896#M28559</guid>
      <dc:creator>Ruggero_Piccoli</dc:creator>
      <dc:date>2020-04-08T08:23:07Z</dc:date>
    </item>
    <item>
      <title>Re: NPrinting API - Create Filter</title>
      <link>https://community.qlik.com/t5/Qlik-NPrinting/NPrinting-API-Create-Filter/m-p/1691909#M28561</link>
      <description>&lt;P&gt;Hi Ruggero,&lt;/P&gt;&lt;P&gt;We have Nprinting version September 2019, I selected 2017 by mistake&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vitalii&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 08:43:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-NPrinting/NPrinting-API-Create-Filter/m-p/1691909#M28561</guid>
      <dc:creator>vitaliichupryna</dc:creator>
      <dc:date>2020-04-08T08:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: NPrinting API - Create Filter</title>
      <link>https://community.qlik.com/t5/Qlik-NPrinting/NPrinting-API-Create-Filter/m-p/1691911#M28562</link>
      <description>&lt;P&gt;Hi Lech,&lt;/P&gt;&lt;P&gt;Thank you for help, I've tried you code, but still have the same issue.&lt;/P&gt;&lt;P&gt;Below you can see my filter body&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;{"Name":"API_Test_Filter","AppId":"c5300cf6-392a-4389-842b-25cc41c7b0d","Enabled":"True"}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Vitali&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 08:45:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-NPrinting/NPrinting-API-Create-Filter/m-p/1691911#M28562</guid>
      <dc:creator>vitaliichupryna</dc:creator>
      <dc:date>2020-04-08T08:45:31Z</dc:date>
    </item>
    <item>
      <title>Re: NPrinting API - Create Filter</title>
      <link>https://community.qlik.com/t5/Qlik-NPrinting/NPrinting-API-Create-Filter/m-p/1691918#M28563</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;No problem, the bug was solved in November 2019 so next version compared to yours. So it could be that you are experiencing it so that you must specify parameters that was declared as optional.&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Ruggero&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 08:55:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-NPrinting/NPrinting-API-Create-Filter/m-p/1691918#M28563</guid>
      <dc:creator>Ruggero_Piccoli</dc:creator>
      <dc:date>2020-04-08T08:55:52Z</dc:date>
    </item>
    <item>
      <title>Re: NPrinting API - Create Filter</title>
      <link>https://community.qlik.com/t5/Qlik-NPrinting/NPrinting-API-Create-Filter/m-p/1691932#M28564</link>
      <description>&lt;P&gt;Ruggero,&lt;/P&gt;&lt;P&gt;Could you please provide example of filter body which you use in the app?&lt;/P&gt;&lt;P&gt;Because I've tried different variants and receive the same result each time.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vitalii&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 09:31:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-NPrinting/NPrinting-API-Create-Filter/m-p/1691932#M28564</guid>
      <dc:creator>vitaliichupryna</dc:creator>
      <dc:date>2020-04-08T09:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: NPrinting API - Create Filter</title>
      <link>https://community.qlik.com/t5/Qlik-NPrinting/NPrinting-API-Create-Filter/m-p/1692030#M28568</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;This body worked in my April 2020 TP installation&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
    "appId": "ab53ef11-3cdc-45af-9403-b788eba2b004",
    "enabled": true,
    "name": "Created via API",
    "description": "Example of a filter created via API Postman",
    "fields": [
        {
            "connectionId": "07d36409-1a43-40ae-a682-e17f8929e9c6",
            "name": "Country",
            "overrideValues": false,
            "selectExcluded": false,
            "values": [
                {
                    "value": "USA",
                    "type": "text"
                }
                ]
        }
                ],
   "variables": []
 }&lt;/LI-CODE&gt;&lt;P&gt;I sent it via Postman&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="post create filter.png" style="width: 988px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/31530iF2E7D677E427F829/image-size/large?v=v2&amp;amp;px=999" role="button" title="post create filter.png" alt="post create filter.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and it created the filter.&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Ruggero&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 14:24:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-NPrinting/NPrinting-API-Create-Filter/m-p/1692030#M28568</guid>
      <dc:creator>Ruggero_Piccoli</dc:creator>
      <dc:date>2020-04-08T14:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: NPrinting API - Create Filter</title>
      <link>https://community.qlik.com/t5/Qlik-NPrinting/NPrinting-API-Create-Filter/m-p/1692060#M28569</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;Looks like I should think how to create JSON hierarchy in the Qlik script.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vitalii&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 15:27:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-NPrinting/NPrinting-API-Create-Filter/m-p/1692060#M28569</guid>
      <dc:creator>vitaliichupryna</dc:creator>
      <dc:date>2020-04-08T15:27:22Z</dc:date>
    </item>
  </channel>
</rss>

