Kerio APIs Client Library for PHP 1.4.0.234
  • Namespace
  • Class
  • Tree
  • Deprecated

Namespaces

  • None
  • PHP

Classes

  • KerioApi
  • KerioApiSocket
  • KerioConnectApi
  • KerioControlApi
  • KerioDirectoryApi
  • KerioOperatorApi
  • KerioWorkspaceApi
  • SamepageApi

Interfaces

  • KerioApiInterface
  • KerioApiSocketInterface

Exceptions

  • KerioApiException

Class KerioApi

Kerio API Class.

This is main class.

Example:

<?php
require_once(dirname(__FILE__) . '/src/KerioApi.php');

class MyApi extents KerioApi {

    public function __contruct($name, $vendor, $version) {
        parent::__construct($name, $vendor, $version);
    }

    public function getFoo() {
        return $this->sendRequest('...');
    }
}
?>
KerioApi implements KerioApiInterface

Direct known subclasses

KerioConnectApi, KerioControlApi, KerioDirectoryApi, KerioOperatorApi, KerioWorkspaceApi, SamepageApi

Copyright: Copyright © 2012-2012 Kerio Technologies s.r.o.
License: http://www.kerio.com/developers/license/sdk-agreement
Version: 1.4.0.234
Located at class/KerioApi.php

Methods summary

public
# __construct( string $name, string $vendor, string $version )

Class contructor.

Class contructor.

Parameters

$name
string
Application name
$vendor
string
Application vendor
$version
string
Application version

Throws

KerioApiException

Implementation of

KerioApiInterface::__construct()
final public array
# getApplication( )

Get application detail.

Get application detail.

Returns

array
Application details
final public
# setJsonRpc( string $version, integer $port, string $api )

Set JSON-RPC settings.

Set JSON-RPC settings.

Parameters

$version
string
JSON-RPC version
$port
integer
JSON-RPC port
$api
string
JSON-RPC URI

Throws

KerioApiException

See

class/KerioApiInterface::setJsonRpc()

Implementation of

KerioApiInterface::setJsonRpc()
final public array
# getJsonRpc( )

Get JSON-RPC settings.

Get JSON-RPC settings.

Returns

array
JSON-RPC settings
final public
# setDebug( boolean $boolean )

Enable or disable of displaying debug messages.

Enable or disable of displaying debug messages.

Parameters

$boolean
boolean
final public boolean
# getDebug( )

Get debug settings.

Get debug settings.

Returns

boolean
public string
# debug( string $message, string $css = 'debug' )

Display a message if debug is TRUE.

Display a message if debug is TRUE.

Parameters

$message
string
Message
$css
string
CSS class

Returns

string
Message in <div> tags
public integer
# getApiVersion( )

Get product API version.

Get product API version.

Returns

integer
API version
public array
# login( string $hostname, string $username, string $password )

Login method.

Login method.

Parameters

$hostname
string
Hostname
$username
string
Username
$password
string
Password

Returns

array
Result

Throws

KerioApiException

See

class/KerioApiInterface::login()

Implementation of

KerioApiInterface::login()
public array
# logout( )

Logout method.

Logout method.

Returns

array
Result

See

class/KerioApiInterface::logout()

Implementation of

KerioApiInterface::logout()
public
# clean( )

Clean data.

Clean data.

protected string
# getHttpRequest( string $method, string $body )

Get full HTTP request.

Get full HTTP request.

Parameters

$method
string
HTTP method [POST,GET,PUT]
$body
string
HTTP body

Returns

string
HTTP request

Throws

KerioApiException
protected string
# getHttpPostRequest( string $data )

Get headers for POST request.

Get headers for POST request.

Parameters

$data
string
Request body

Returns

string
Request body
protected string
# getHttpGetRequest( string $data )

Get headers for GET request.

Get headers for GET request.

Parameters

$data
string
Request body

Returns

string
Request body
protected string
# getHttpPutRequest( string $data )

Get headers for PUT request.

Get headers for PUT request.

Parameters

$data
string
Request body

Returns

string
Request body
public array
# sendRequest( string $method, array $params = '' )

Send request using method and its params.

Send request using method and its params.

Parameters

$method
string
Interface.method
$params
array
Params of 'Interface.method'.

Returns

array
Returns same type as param is, e.g. JSON if method is also JSON

See

class/KerioApiInterface::sendRequest()

Implementation of

KerioApiInterface::sendRequest()
public string
# sendRequestJson( string $json )

Send JSON request.

Send JSON request.

Parameters

$json
string
JSON request

Returns

string
JSON response
protected string
# send( string $method, string $data )

Send data to server.

Send data to server.

Parameters

$method
string
Request method [POST,GET,PUT]
$data
string
Request body

Returns

string
Server response

Throws

KerioApiException
public boolean
# downloadFile( string $url, string $directory, string $filename = '' )

Get a file from server.

Get a file from server.

Parameters

$url
string
File url
$directory
string
Save directory
$filename
string
Save as, optional. Default is file.bin

Returns

boolean
True on success

Throws

KerioApiException
public string
# getFile( string $url )

Get a file from server.

Get a file from server.

Parameters

$url
string
File url

Returns

string
File content
public array
# uploadFile( string $filename, integer $id = null )

Put a file to server.

Put a file to server.

Parameters

$filename
string
Absolute path to file
$id
integer
Reference ID where uploaded file belongs to, optional

Returns

array
Result

Throws

KerioApiException
protected boolean
# checkHttpResponse( integer $code, string $headers )

Check HTTP/1.1 reponse header.

Check HTTP/1.1 reponse header.

Parameters

$code
integer
Requested HTTP code
$headers
string
HTTP headers

Returns

boolean
True if match

Throws

KerioApiException
public
# setHostname( string $hostname )

Set hostname.

Set hostname.

Parameters

$hostname
string
Hostname
protected
# setToken( string $token )

Set security Cross-Site Request Forgery X-Token.

Set security Cross-Site Request Forgery X-Token.

Parameters

$token
string
X-Token value
public string
# getToken( )

Get security Cross-Site Request Forgery X-Token.

Get security Cross-Site Request Forgery X-Token.

Returns

string
X-Token value
protected
# setCookie( string $cookies )

Set Cookies.

Set Cookies.

Parameters

$cookies
string
Cookies
public string
# getCookie( )

Get Cookies.

Get Cookies.

Returns

string
Cookies
public
# setTimeout( integer $timeout )

Set connection timeout.

Set connection timeout.

Parameters

$timeout
integer
Timeout in seconds

Magic methods summary

Constants summary

string CRLF "\r\n"
#

End-Line format

End-Line format

integer HTTP_SERVER_OK 200
#

HTTP server status

HTTP server status

Properties summary

public string $name
#

Library name

Library name

public string $version
#

Library version

Library version

protected string $hostname
#

Hostname

Hostname

protected string $token
#

X-Token

X-Token

protected string $cookies
#

Cookies

Cookies

protected array $application
#

Application details

Application details

protected array $jsonRpc
#

JSON-RPC settings

JSON-RPC settings

protected array $headers
#

HTTP headers

HTTP headers

Kerio APIs Client Library for PHP 1.4.0.234 API documentation generated by ApiGen 2.8.0