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

Creating multiple identical hosts via API is possible

XMLWordPrintable

      Steps to reproduce:

      1. Run 2 async curl requests
      curl --location --request POST 'https://zabbix.example.com/api_jsonrpc.php' --header 'Content-Type: application/json' \
      --data-raw '{ "jsonrpc": "2.0", "method": "host.create", "params": { "host": "hostname_test1", "name": "visiblename_test1", "groups": [ { "groupid": "293" } ], "templates": [ { "templateid": "35188" } ] }, "id": 1, "auth": "apikey" }' & \
      curl --location --request POST 'https://zabbix.example.com/api_jsonrpc.php' --header 'Content-Type: application/json' \
      --data-raw '{ "jsonrpc": "2.0", "method": "host.create", "params": { "host": "hostname_test1", "name": "visiblename_test1", "groups": [ { "groupid": "293" } ], "templates": [ { "templateid": "35188" } ] }, "id": 1, "auth": "apikey" }'
      1. Response is
      {"jsonrpc":"2.0","result":{"hostids":["35198"]},"id":1}
      {"jsonrpc":"2.0","result":{"hostids":["35199"]},"id":1}

      Result:
      Two identical hosts are created:

      Expected:
      Creating only the first/one host.

            zabbix.support Zabbix Support Team
            yuriip Yurii Polenok
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: