Greetings everyone,
I'm trying to connect to Zabbix through API but it seems I can't get anything done. All forms I tried result in errors, even from inside the server. I tried many ways to retrieve apiiversion and to use user.login.
My frontend is at http://192.168.0.100/zabbix
I did not install the frontend. It was given to me to work on. Can it be any issue with the installation? There's anything I need to configure?
Zabbix version is 5.0.16 and the api files are found on following places:
# find . -name api_jsonrpc.php
./opt/zabbix-backup/zabbix/api_jsonrpc.php
./opt/comp/zabbix-5.0.16/ui/api_jsonrpc.php
./usr/share/zabbix/api_jsonrpc.php
----
I tried using curl from inside the server, to localhost and real IP, didn't work:
curl -s -X POST -H 'Content-Type: application/json-rpc' -d '{"jsonrpc":"2.0","method":"apiinfo.version","id ": 1,"auth":null,"params":{}}' 'http://127.0.0.1/zabbix/api_jsonrpc.php'
curl -s -X POST -H 'Content-Type: application/json-rpc' -d '{"jsonrpc":"2.0","method":"apiinfo.version","id ": 1,"auth":null,"params":{}}' 'http://192.168.0.100/zabbix/api_jsonrpc.php'
And results are:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="https://127.0.0.1/api_jsonrpc.php">here</a>.</p>
</body></html>
----
I tried through Postman app too:
POST http://192.168.0.100/zabbix/api_jsonrpc.php
Headers:
Content-Type: application/json
Body: raw
{
"jsonrpc":"2.0",
"method":"apiinfo.version",
"params":{},
"id":1
}
And results are:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head>
<title>400 Bad Request</title>
</head>
<body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br/>
</p>
</body>
</html>
I'm trying to connect to Zabbix through API but it seems I can't get anything done. All forms I tried result in errors, even from inside the server. I tried many ways to retrieve apiiversion and to use user.login.
My frontend is at http://192.168.0.100/zabbix
I did not install the frontend. It was given to me to work on. Can it be any issue with the installation? There's anything I need to configure?
Zabbix version is 5.0.16 and the api files are found on following places:
# find . -name api_jsonrpc.php
./opt/zabbix-backup/zabbix/api_jsonrpc.php
./opt/comp/zabbix-5.0.16/ui/api_jsonrpc.php
./usr/share/zabbix/api_jsonrpc.php
----
I tried using curl from inside the server, to localhost and real IP, didn't work:
curl -s -X POST -H 'Content-Type: application/json-rpc' -d '{"jsonrpc":"2.0","method":"apiinfo.version","id ": 1,"auth":null,"params":{}}' 'http://127.0.0.1/zabbix/api_jsonrpc.php'
curl -s -X POST -H 'Content-Type: application/json-rpc' -d '{"jsonrpc":"2.0","method":"apiinfo.version","id ": 1,"auth":null,"params":{}}' 'http://192.168.0.100/zabbix/api_jsonrpc.php'
And results are:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="https://127.0.0.1/api_jsonrpc.php">here</a>.</p>
</body></html>
----
I tried through Postman app too:
POST http://192.168.0.100/zabbix/api_jsonrpc.php
Headers:
Content-Type: application/json
Body: raw
{
"jsonrpc":"2.0",
"method":"apiinfo.version",
"params":{},
"id":1
}
And results are:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head>
<title>400 Bad Request</title>
</head>
<body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br/>
</p>
</body>
</html>
Comment