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

JSON request deserves a JSON response, Zabbix API

    XMLWordPrintable

    Details

    • Team:
      Team B
    • Sprint:
      Sprint 70 (Nov 2020), Sprint 71 (Dec 2020), Sprint 72 (Jan 2021), Sprint 73 (Feb 2021)
    • Story Points:
      3

      Description

      On a stock 5.0 installation, we can link a trigger to an item by using

      curl -s -i -X POST -H 'Content-Type: application/json-rpc' -d '{
      	"jsonrpc": "2.0",
      	"method": "trigger.create",
      	"id": 1,
      	"auth": "d5382583a3ab9dd8fa4cf7e2c967558a",
      	"params": [{
      		"description": "hello",
      		"expression": "{Zabbix server:zabbix[queue].last()}>7",
      		"priority": 4,
              "dependencies":null,
              "url":null,
              "tags":[]
      	}]
      }' http://127.0.0.1/api_jsonrpc.php
      

      However, if we request different content ("tags":null) which is still valid JSON:

      curl -s -i -X POST -H 'Content-Type: application/json-rpc' -d '{
      	"jsonrpc": "2.0",
      	"method": "trigger.create",
      	"id": 1,
      	"auth": "d5382583a3ab9dd8fa4cf7e2c967558a",
      	"params": [{
      		"description": "hello",
      		"expression": "{Zabbix server:zabbix[queue].last()}>7",
      		"priority": 4,
              "dependencies":null,
              "url":null,
              "tags":null
      	}]
      }' http://127.0.0.1/api_jsonrpc.php
      

      we receive:
      HTTP/1.1 500 Internal Server Error
      Server: nginx/1.16.1
      Date: Mon, 05 Oct 2020 11:57:33 GMT
      Content-Type: application/json
      Transfer-Encoding: chunked
      Connection: keep-alive
      X-Powered-By: PHP/7.2.24
      Access-Control-Allow-Origin: *
      Access-Control-Allow-Headers: Content-Type
      Access-Control-Allow-Methods: POST
      Access-Control-Max-Age: 1000 

        Attachments

          Activity

            People

            Assignee:
            Miks.Kronkalns Miks Kronkalns
            Reporter:
            aigars.kadikis Aigars Kadikis
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: