Connect. Communicate. Collaborate. Securely.

Home » Developer Zone » API/SDK Writers » Changes in API (PHP vs JSON)
  •  
nhoague

Messages: 853
Karma: 18
Send a private message to this user
Hello,

While developing the myServers script I used the new kerio php api class. I have about 10 other api scripts that use the old style of sending a full json request and then decoding json.

I liked the new kerio php api class, but find that to convert all of my scripts to use this new class is going to be very time consuming.

Is there any benefit to converting? Will any new API still use json? Will new versions of the product respond with the correct json syntax for decoding?

Thanks!
  •  
Miroslav Osladil (Kerio)

Messages: 188

Karma: 27
Send a private message to this user
Hi Nick,

we have no reason stop using JSON. The PHP classes are just a wrapper for the JSON. Smile

There are two ways of sending a request in the kerio-api-php library:
  1. sendRequest($method, $params)
  2. sendRequestJson($json)

First is more PHP native, second one accepts full JSON request as sometimes showed in post replies.

The main difference is that if you use sendRequest() you get PHP array as the result. If you use sendRequestJson() you still need to use json_decode to get the PHP array. Smile So the benefit, from my point of view is, when copy&paste some requests (Firebug/Developer Tools) used in our Web Administration.

Feel free to use both option.

I would personally prefer the first one. Smile

M.

Miroslav Osladil
Senior Developer
Kerio Technologies

The views I express are my own and do not necessarily reflect the views of Kerio Technologies.
  •  
nhoague

Messages: 853
Karma: 18
Send a private message to this user
Thanks M. Great answer! I do think I am going to convert my scripts to the php request, it is much cleaner code!
Previous Topic: Documentation for API for Control/Operator
Next Topic: List traffic rules
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: Thu Oct 19 18:11:56 CEST 2017

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