mattiasgeniar / MoZBX

Mobile Zabbix frontend for iPhone, Android, Windows Mobile, ...
http://www.mozbx.net
69 stars 28 forks source link

Zabbix 2.4: authenticatie API point changed name #44

Open mattiasgeniar opened 9 years ago

mattiasgeniar commented 9 years ago

Action: user.authenticate Request:

{  
   "auth":null,
   "method":"user.authenticate",
   "id":1,
   "params":{  
      "user":"xxx",
      "password":"xxx"
   },
   "jsonrpc":"2.0"
}

Response:

{  
   "jsonrpc":"2.0",
   "error":{  
      "code":-32602,
      "message":"Invalid params.",
      "data":"Incorrect method user.authenticate."
   },
   "id":1
}

user.authenticate is a deprecated alias of user.login

MASantangelo commented 9 years ago

class_zabbix @ 161,39: change user.authenticate to user.login --- this works for me. I know this is old but I just saw your stuff and I'm playing with it on Zabbix 2.4.

So line 161 goes from:

$result = $this->sendRequest("user.authenticate", array("user" => $this->getUsername(), "password" => $this->getPassword()));

to

$result = $this->sendRequest("user.login", array("user" => $this->getUsername(), "password" => $this->getPassword()));
intrepidsilence commented 9 years ago

This only fixes part of the issue. It appears that aping is still being called with auth in it which no longer works. You need a different function defined without auth to pre-login requests like apiinfo.

Source IP: 10.x.x.x
API URL: http://zabbix-server.localdomain/zabbix/api_jsonrpc.php
Action: apiinfo.version
Request:
'{"auth":"<hash>","method":"apiinfo.version","id":1,"params":[],"jsonrpc":"2.0"}'

Response:
'{"jsonrpc":"2.0","error":{"code":-32602,"message":"Invalid params.","data":"The \\"apiinfo.version\\" method must be called without the \\"auth\\" parameter."},"id":1}'
=======
wayneward commented 8 years ago

i tried above method bu get this error no permission to referred object or it does not exist