zabbix 6.x

zabbix 版本小于 6.0

使用curl 获取,使用前请根据实际情况替换地址、用户和密码。

curl --location --request POST 'https://demo.zabbix.com/api_jsonrpc.php' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
        "method": "user.login",
            "params": {
        "user": "username",
            "password": "passwd"
    },
    "id": 1,
        "auth": null
}'

返回结果如下,其中 result 是 api token。

{"jsonrpc":"2.0","result":"4d4a759710e3532040df7620a1626155","id":1}