Connect. Communicate. Collaborate. Securely.

Home » Kerio User Forums » Kerio Connect » API login doesn't work (seems to be related to newer versions)
  •  
znh1

Messages: 3
Karma: 0
Send a private message to this user
I'm trying to get the API to work with Keri Connect. However the following response is what I get after sending the request. I've taken the sample code from the API documentation from Kerio's website. I noticed that this happens with newer Kerio versions. An older Kerio seems to work with the exact same request. Any help would be greatly appreciated.


---REQUEST---
POST /admin/api/jsonrpc/ HTTP/1.1
Accept: application/json-rpc
Content-Type: application/json-rpc
Host: 123.123.123.233:4040
Content-Length: 338
Connection: close

{
"jsonrpc": "2.0",
"id": 1,
"method": "Session.login",
"params": {
"username": "admin<_at_>domain.com",
"password": "123456",
"application": {
"name": "Hello World!",
"vendor": "First Automated Administrations, Corp.",
"version": "1.0.0"
}
}
}

---RESPONSE---
HTTP/1.1 200 OK
Connection: Close
Content-Type: application/json-rpc; charset=utf-8
Date: Wed, 4 Jan 2012 19:49:07 GMT
Server: Kerio Connect 7.3.0
X-UA-Compatible: IE=edge

{"jsonrpc":"2.0","id":1,"error":{"code":-32602,"message ":"Invalid params.","data":{"messageParameters":{"positionalParameters ":[],"plurality":1}}}}
  •  
davidj

Messages: 8
Karma: 0
Send a private message to this user
I send it just like this:

{"jsonrpc":"2.0","id":1,"method":"Session.login","params ":{"userName":"admin","password":"mypass","application ":{"name":"Kerio Administration API Tester","vendor":"Kerio Technologies s.r.o.","version":"1.0"}}}

I send it as a single line, not broken out. I copied this format from the apitester. Don't use that Hello World stuff. Try the exact thing above, that's what echoed out of the php functions that are known good.
  •  
znh1

Messages: 3
Karma: 0
Send a private message to this user
Thanks for you reply. I tried quering Kerio with the request given. The response however is quite the same:

---REQUEST---
POST /admin/api/jsonrpc/ HTTP/1.1
Accept: application/json-rpc
Content-Type: application/json-rpc
Host: 123.123.123.233:4040
Content-Length: 211
Connection: close

{"jsonrpc":"2.0","id":1,"method":"Session.login","params ":{"userName":"admin","password":"mypass","application ":{"name":"Kerio Administration API Tester","vendor":"Kerio Technologies s.r.o.","version":"1.0"}}}

---RESPONSE---
HTTP/1.1 200 OK
Connection: Close
Content-Type: application/json-rpc; charset=utf-8
Date: Fri, 6 Jan 2012 09:16:56 GMT
Server: Kerio Connect 7.3.0
X-UA-Compatible: IE=edge

{"jsonrpc":"2.0","id":1,"error":{"code":-32602,"message ":"Invalid params.","data":{"messageParameters":{"positionalParameters ":[],"plurality":1}}}}

[Updated on: Fri, 06 January 2012 10:18]

  •  
davidj

Messages: 8
Karma: 0
Send a private message to this user
Have you successfully used the apitester? Can you get past the ip, name, pass with that?
  •  
znh1

Messages: 3
Karma: 0
Send a private message to this user
The ApiTester does work. Thanks for pointing out into the right direction!
  •  
davidj

Messages: 8
Karma: 0
Send a private message to this user
Do you want the code for the echo out of the php? Or you want to do it, the echo out of the php was what I used for my login stuff.
  •  
davidj

Messages: 8
Karma: 0
Send a private message to this user
In case anyone else ever reads this, I inserted these two lines at line 41 of index.php of the apitester.

echo $request->getLogin($_POST['username'], $_POST['password']);
			
exit();


such that the before and after lines are

Tools::setSession('', array(), $host[0], $port);

echo $request->getLogin($_POST['username'], $_POST['password']);
			
exit();

$response = $request->send($request->getLogin($_POST['username'], $_POST['password']));


This will output the string that is used to login through the API. This same string can be used for manual api calls.

[Updated on: Fri, 06 January 2012 15:10]

  •  
Miroslav Osladil (Kerio)

Messages: 188

Karma: 27
Send a private message to this user
Hello,

in case you are still interested in our Administration API for Kerio Connect, I would recommend to check out Kerio Developer Zone which contains some examples and sample applications using the Kerio APIs Client Library for PHP.

Best regards,

Miroslav Osladil
Senior Developer
Kerio Technologies

The views I express are my own and do not necessarily reflect the views of Kerio Technologies.
Previous Topic: Get users with API
Next Topic: New kerioConnect 7.3 - problem with reading emails on Nokia e52
Goto Forum:
  


Disclaimer:
Kerio discussion forums are intended for open communication between forum members and may contain information and material posted by members which may be useful in learning about Kerio products. The discussion forums are not intended to provide technical support for any specific product. Any information implied or expressed in the discussion forums is that of the posting member. Kerio is in no way responsible for the information posted in the forums, or its accuracy. Kerio employees may participate in the discussions, but their postings do not represent an offical position of the company on any issues raised or discussed. Kerio reserves the right to monitor and maintain the forums to promote free and accurate exchange of information.

Current Time: Fri Nov 24 15:50:34 CET 2017

Total time taken to generate the page: 0.00401 seconds
.:: Contact :: Home ::.
Powered by: FUDforum 3.0.4.