3 Replies Latest reply: Dec 11, 2017 7:47 AM by Shneior Dicastro RSS

    Howto set NPrining report filters trough REST Api?

    Nikolay Chapkin

      Hi,

      I try to get report from NPrinting. I send POST OnDemandRequest and then get it by GET-call OnDemandRequestResult.

      Another task, I need to filter my report by some values (eg - quarter, year etc.). I try send PUT Filter request but get error - 400 with a message "Request is malformed". What I'm doing wrong?

       

      This is JSON of the PUT-filter request:

      {

        "id": "6c567bc4-1378-44c2-de4e-ff45673df23c",

        "enabled": "True",

        "fields": [{

        "name": "flag",

        "overrideValues": "True",

        "values": []

        }, {

        "name": "Test",

        "overrideValues": "True",

        "values": [{

        "value": "3",

        "type": "number"

        }, {

        "value": "4",

        "type": "number"

        }

        ]

        }

        ]

      }

        • Re: Howto set NPrining report filters trough REST Api?
          Shneior Dicastro

          {

          "appId": "e278ee9a-8985-46da-9aa8-75c2474a4cb1",

          "enabled":"True",

          "name": "NEW_FILTER",

          "fields": [

          {

          "connectionId": "cd9207ef-0eb9-4124-81b7-35f6913ed03c",

          "name": "FILED_TO_FILTER",

          "overrideValues": "false",

                                  "values": [

                                      {

                                          "value": "1",

                                          "type": "number"

                                      }

                                  ]

          }

          ]

          }

            • Re: Howto set NPrining report filters trough REST Api?
              Lech Miszkiewicz

              This is very interesting - does it mean that filter has to exist in first place before you can apply it?

                • Re: Howto set NPrining report filters trough REST Api?
                  Shneior Dicastro

                  There is no meaning to the order of the field they just must to be there

                  for exemple you can write as follow

                   

                  {

                  "appId": "e278ee9a-8985-46da-9aa8-75c2474a4cb1",

                  "enabled":"True",

                  "name": "NEW_FILTER",

                  "fields": [

                  {

                  "name": "FILED_TO_FILTER",

                  "overrideValues": "false",

                                          "values": [

                                              {

                                                  "value": "1",

                                                  "type": "number"

                                              }

                                          ],

                  "connectionId": "cd9207ef-0eb9-4124-81b7-35f6913ed03c"

                   

                  }

                  ]

                  }

                  note: that json add a new filter and you need to apply it on app/report/contact