Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-17158

API: preservekeys parameter influences sortorder

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Won't fix
    • Icon: Trivial Trivial
    • None
    • 4.0.16, 4.4.4, 5.0.0alpha1
    • API (A)
    • None
    • Team B
    • Sprint 60 (Jan 2020)
    • 0.5

      Steps to reproduce:
      For example try "script.get" request:

      "jsonrpc": "2.0",
          "method": "script.get",
          "params": {
          	"output" : ["scriptid"],
          	"sortfield": ["scriptid"],
          	"sortorder": "DESC"
          },
      

      The result will be scripts sorted descending by script id (EXPECTED):

      {
          "jsonrpc": "2.0",
          "result": [
              {
                  "scriptid": "8"
              },
              {
                  "scriptid": "6"
              },
              {
                  "scriptid": "4"
              },
              {
                  "scriptid": "3"
              },
              {
                  "scriptid": "2"
              },
              {
                  "scriptid": "1"
              }
          ],
          "id": 1
      }
      

      Add preservekeys parameter to request:

      "jsonrpc": "2.0",
          "method": "script.get",
          "params": {
          	"output" : ["scriptid"],
          	"sortfield": ["scriptid"],
          	"sortorder": "DESC",
              "preservekeys": true
          },
      

      Scripts in result became sorted ascending (NOT EXPECTED):

      {
          "jsonrpc": "2.0",
          "result": {
              "1": {
                  "scriptid": "1"
              },
              "2": {
                  "scriptid": "2"
              },
              "3": {
                  "scriptid": "3"
              },
              "4": {
                  "scriptid": "4"
              },
              "6": {
                  "scriptid": "6"
              },
              "8": {
                  "scriptid": "8"
              }
          },
          "id": 1
      }
      

            zabbix.dev Zabbix Development Team
            lgrigorjeva Larisa Grigorjeva
            Team B
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: