0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Zabbix5.0とZabbix7.0のAPI仕様が異なっていたためハマった話

Posted at

ZabbixのAPI使ってますか?

ZabbixのAPI使ってますか?
トラフィックデータを取ってきたり、ホストを登録したりいろいろできます
https://www.zabbix.com/documentation/7.0/en/manual/api

API仕様でハマった

Zabbix5.0と7.0でAPIの仕様が微妙に異なっています

以下は認証時に投げるAPIのデータ部分です。
何と、paramsの中のuserがusernameになっている...
これに気付かず、無駄に2週間格闘してしまいました

zabbix5.0のAPI
https://www.zabbix.com/documentation/5.0/en/manual/api

Zabbix5.0のAPI
{
    "jsonrpc": "2.0",
    "method": "user.login",
    "params": {
        "user": "Admin",
        "password": "zabbix"
    },
    "id": 1,
    "auth": null
}

zabbix7.0のAPI
https://www.zabbix.com/documentation/7.0/en/manual/api

Zabbix7.0のAPI
{
  "jsonrpc": "2.0",
  "method": "user.login",
  "params": {
        "username": "Admin",
        "password": "zabbix"
  },
  "id": 1
}

まとめ

バージョンアップしたらAPIの仕様もきちんと確認しよう

user→usernameは気付かないよ...

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?