<commit_before>h1. Kayako REST API Client

"Kayako Resolve":http://www.kayako.com/products/resolve/ is a comprehensive helpdesk and ticket management solution. It exposes "REST API":http://wiki.kayako.com/display/DEV/REST+API which can be used for example to create new tickets from external systems. To facilitate the use of this API I created a client written in PHP.

h1. Prerequisities

h2. PHP

Client requires PHP >= 5.3.0 (beacause late static binding is used) with enabled support for: libXML, cURL, hash, fileinfo and date/time.

h2. Kayako

This version of the client was designed for version 4.01.204.
I had some problems in Kayako prior to version 4_01_204, so it's better to upgrade at least to this version.

While implementing this client I came across few inconsitencies and missing data in Kayako API, so I introduced following changes to the source code of Kayako:
* order ticket posts and notes by their creation date (older first)
* include identifier in ticket note and ticket time track
* include ticket identifier in ticket note and ticket time track
* include user identifier in ticket user note
* include user organization identifier in ticket user organization note
* change "ticketpostid" element of ticket to "id" (leave "ticketpostid" for backward compatibility)
* include ticket identifier in ticket post

*IMPORTANT*
Without the patch it won't be possible to delete ticket notes and ticket posts. If it's ok for you, than you don't need to apply the patch.

In order to take advantage of these changes you must patch your Kayako installation. Patches starting from version 4_01_204 of Kayako Fusion are included in "patch" directory. To apply the patch copy it to root directory of Kayako installation and run
<pre>
patch -p0 < patch-4_01_204.diff
</pre>

h1. Examples

Example is also provided with source in example.php file.

h2. Initialising the client.

<pre>
require_once("kyIncludes.php");

//client initialization
kyBase::init("http://mykayako.example.com/api/index.php", "<API key>", "<Secret key>");
</pre>

h2. Setting defaults for ticket creation

This step is optional. If the client will be used to create tickets it's recommended to set default status, priority and type of new tickets:<commit_msg>- updated supported Kayako version in  README<commit_after>h1. Kayako REST API Client

"Kayako Resolve":http://www.kayako.com/products/resolve/ is a comprehensive helpdesk and ticket management solution. It exposes "REST API":http://wiki.kayako.com/display/DEV/REST+API which can be used for example to create new tickets from external systems. To facilitate the use of this API I created a client written in PHP.

h1. Prerequisities

h2. PHP

Client requires PHP >= 5.3.0 (beacause late static binding is used) with enabled support for: libXML, cURL, hash, fileinfo and date/time.

h2. Kayako

This version of the client is designed for Kayako version 4.01.240.

h1. Examples

Example is also provided with source in example.php file.

h2. Initialising the client.

<pre>
require_once("kyIncludes.php");

//client initialization
kyBase::init("http://mykayako.example.com/api/index.php", "<API key>", "<Secret key>");
</pre>

h2. Setting defaults for ticket creation

This step is optional. If the client will be used to create tickets it's recommended to set default status, priority and type of new tickets:
{'fraction_non_alphanumeric': 0.07038473009245452, 'fraction_numerical': 0.01521025946913212, 'mean_word_length': 4.516447368421052, 'pattern_counts': {'":': 4, '<': 14, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7506489', 'n_tokens_mistral': 945, 'n_tokens_neox': 896, 'n_words': 466}