Interface of REST client.

If you want to use another REST client than the default, make a class implementing this interface and pass its instance to

see \global\kyConfig::setRESTClient()
author Tomasz Sawicki (https://github.com/Furgas)
package Common\REST

 Methods

Should delete object from server by sending DELETE request.

delete(string $controller, array $parameters) 

Parameters

$controller

string

Kayako controller to call.

$parameters

array

List of additional parameters (like object identifiers or search parameters).

Should send GET request to the server and return parsed data.

get(string $controller, array $parameters) : array

Parameters

$controller

string

Kayako controller to call.

$parameters

array

Optional. List of additional parameters (like object identifiers or search parameters).

Returns

arrayXML parsed to array in @see ky_xml_to_array() style.

Should create object on the server by sending POST request and return its data.

post(string $controller, array $parameters, array $data, array $files) : array

Format of $files parameter:

array(
    '' =>
        array('file_name' => '', 'contents' => ''),
    ...repeat...
)

Parameters

$controller

string

Kayako controller to call.

$parameters

array

Optional. List of additional parameters (like object identifiers or search parameters).

$data

array

Optional. Data array with parameter name as key and parameter value as value.

$files

array

Optional. Array of files.

Returns

arrayXML parsed to array in @see ky_xml_to_array() style.

Should update object on the server by sending PUT request and return its new data.

put(string $controller, array $parameters, array $data, array $files) : array

Format of $files parameter:

array(
    '' =>
        array('file_name' => '', 'contents' => ''),
    ...repeat...
)

Parameters

$controller

string

Kayako controller to call.

$parameters

array

Optional. List of additional parameters (like object identifiers or search parameters).

$data

array

Optional. Data array with parameter name as key and parameter value as value.

$files

array

Optional. Array of files in form of: array('' => array('file_name' => '', 'contents' => ''), ...).

Returns

arrayXML parsed to array in @see ky_xml_to_array() style.

Configuration injector.

setConfig(\kyConfig $config) 

Parameters

$config

\kyConfig

Library configuration.

 Constants

 

HTTP verb - DELETE.

METHOD_DELETE : string

For deleting objects.

 

HTTP verb - GET.

METHOD_GET : string

For getting objects.

 

HTTP verb - POST.

METHOD_POST : string

For creating object.

 

HTTP verb - PUT.

METHOD_PUT : string

For updating objects.