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

Runtime error sending API request without square brackets in params

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • None
    • 5.2.3rc1, 5.4.0alpha1
    • API (A)

       

      Steps to reproduce:

      1) Send API request - "host.get"

      example:

       {
          "jsonrpc": "2.0",
          "method": "host.get",
          "params": {
              "output": "hostid",
              "selectGroups": "extend",
              "filter": {
                  "host": [
                      "H1"
                  ]
              }
          },

      "output": "hostid" - without square brackets (in zabbix documents, with - host.get)

       Result:
      No error in postman response. 

      But checking runtime errors we see: 

       in_array() expects parameter 2 to be array, string given [api_jsonrpc.php:63 -> CJsonRpc->execute() -> CLocalApiClient->callMethod() -> CHost->get() -> CHost->applyQueryOutputOptions() -> CApiService->outputIsRequested() -> in_array() -> CConfigFile->{closure}() in include/classes/api/CApiService.php:269]

      Expected:
      Not sure that runtime error should exists...

            zabbix.dev Zabbix Development Team
            smaklakovs Sergejs Maklakovs
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: