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

Creating HTTP test with "posts" in step does not work

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Won't fix
    • Icon: Trivial Trivial
    • None
    • 4.4.1
    • API (A)
    • CentOS 7, PostgreSQL DB, Apache httpd Frontend

      Steps to reproduce:

      1. Install Zabbix 4.4.1 using packages.
      2. Create a host and application (via API or UI).
      3. Post the following request:

       

      {
        "jsonrpc": "2.0",
        "method": "httptest.create",
        "params": {
          "steps": [
            {
              "name": "Get the page and expect 200 and body html tag",
              "url": "http://example/page",
              "status_codes": "200",
              "required": "<body>",
              "follow_redirects": "1",
              "retrieve_mode": "1",
              "timeout": "15s",
              "posts": "",
              "headers": [],
              "variables": [],
              "query_fields": [],
              "no": 1
            },
            {
              "name": "Post something to my backend and expect a success response",
              "url": "http://example/backend/create",
              "posts": "{\"username\":\"admin\"}",
              "status_codes": "201",
              "required": "\"success\": true",
              "headers": [
                {
                  "name": "Content-Type",
                  "value": "application/json"
                }
              ],
              "follow_redirects": "1",
              "retrieve_mode": "1",
              "timeout": "15s",
              "variables": [],
              "query_fields": [],
              "no": 2
            }
          ],
          "name": "Example Scenario",
          "agent": "Zabbix",
          "authentication": "0",
          "delay": "1m",
          "retries": "1",
          "status": "0",
          "verify_host": "0",
          "verify_peer": "0",
          "headers": [],
          "variables": [],
          "http_user": "",
          "http_password": "",
          "http_proxy": "",
          "ssl_cert_file": "",
          "ssl_key_file": "",
          "ssl_key_password": "",
          "applicationid": "<applicationid>",
          "hostid": "<hostid>"
        },
        "id": 11,
        "auth": "<authtoken>"
      }

       

      Result:
      Response from host:

       

      {
        "jsonrpc": "2.0",
        "error": {
          "code": -32602,
          "message": "Invalid params.",
          "data": "Incorrect value for field \"posts\": should be empty."
        },
        "id": 11
      }

      Expected:
      HTTP Test is created with the two steps (one with post data and one without)

       

      Response from host:

      {
        "jsonrpc": "2.0",
        "result": {
          "httptestids": [
            "<some new id>"
          ]
        },
        "id": 11
      }
      

            zabbix.support Zabbix Support Team
            KISTERS KISTERS AG
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: