Ad Widget

Collapse

Learning the API

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • marachtingi
    Junior Member
    • Jun 2022
    • 1

    #1

    Learning the API

    I'm new to zabbix (and relatively new to json queries.)
    I get the impression that there is some knowledge that I'm missing, because the documentation is so brief. Is there an underlying technology to the APIs that I can research, that would help me understand how to build the request body? E.g., "this api is based on GraphQL, learn about that first")

    For example, I'd like to fetch the host name and latest value all the items with names matching "foo.*" from all hosts that have names containing "bar".

    This works to find those hosts, and only two item fields "name" and "lastvalue":
    {
    "jsonrpc": "2.0",
    "method": "host.get",
    "params": {
    "output": [
    "hostid",
    "host",
    "name"
    ],
    "search": {
    "name":"bar"
    },
    "selectItems": [
    "name",
    "lastvalue"
    ]
    },
    "id": 2,
    "auth": "{{auth_token}}"
    }


    ... but I cannot see how to only show the items with "bar" in the name.
Working...