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

I can't create an action via zabbix api in version 6.0.4

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Won't fix
    • Icon: Trivial Trivial
    • None
    • 6.0.4
    • None
    • None
    • Zabbix version: 6.0.4
      Ubuntu 20.04.4 LTS
      Kernel 5.13.0-1025-aws

      Steps to reproduce:

      1. I use the follow script to create an action.

       

       

      #!/usr/bin/env bash
      
      URL='http://192.168.11.95/zabbix/api_jsonrpc.php'
      HEADER='Content-Type:application/json'
      USER='"Admin"'
      PASS='"zabbix"'
      authentication()
      {
          JSON='
          {
              "jsonrpc": "2.0",
              "method": "user.login",
              "params": {
                  "user": '$USER',
                  "password": '$PASS'
              },
              "id": 0
          }
          '
          curl -s -X POST -H "$HEADER" -d "$JSON" "$URL" | cut -d '"' -f8
      }
      TOKEN=$(authentication)
       
      createAction()
      {
              JSON='
          {
              "jsonrpc": "2.0",     
              "method": "action.create",     
              "params": 
              {
              "name": "Information", 
              "eventsource": 0, 
              "status": 0, 
              "esc_period": "2m", 
              "filter": {
                  "evaltype": 0, 
                  "conditions": [
                  {
                      "conditiontype": 4, 
                      "operator": 0, 
                      "value": 1
                  }
                  ]
              }, 
              "operations": [
              {
                  "operationtype": 0, 
                  "esc_period": "1m", 
                  "esc_step_from": 1, 
                  "esc_step_to": 1, 
                  "evaltype": 0, 
                  "opmessage_usr": [
                  {
                      "userid": "2"
                  }
                  ], 
                  "opmessage": {
                      "default_msg": 1, 
                      "mediatypeid": "9",
                      "message": "OI",
                      "subject": "test"
                  }, 
                  "opconditions": [
                  {
                      "conditiontype": 14,
                      "operator": 0, 
                      "value": "0"
                  }
                  ]
              }
              ]
              },     
                 "auth": "'$TOKEN'",
                     "id": 1
                 }
               '
          curl -s -X POST -H "$HEADER" -d "$JSON" "$URL"
      }
      
      createAticion
       
      

       

      But it's not work. The follow message is exhibit.

       

       

      $ bash default.sh 
      {"jsonrpc":"2.0","error":

      {"code":-32602,"message":"Invalid params.","data":"Invalid parameter \"/1/operations/1/opmessage\": unexpected parameter \"subject\"."}

      ,"id":1}
      ${code}
      I tested on 5.0.10 is worked. If i remove the subject and message. It's works on 6.0.4 version.

      Let me know if i'm something doing wrong.

      Result:
      Expected:

            vstepanov Vladimir Stepanov (Inactive)
            rbarbosa Ricardo Barbosa Dias
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: