Kayako API: How to Post a Ticket

A basic PHP example of how to post a new ticket via the Kayako v4 Rest API

<?php
 
$apiUrl = "https://support.domain.com/api/index.php?e=/Tickets/Ticket";
$apiKey = "78db96b0-1t7c-aea4-bd51-7xf39d50cdd6";
$salt = mt_rand();
$secretKey = "ZjBiZS0N2MtMzM3MTkyNTkxMjdiZWZkMGIjE3YmJiMGUtNmY0MC0yNW
U0LWY5x6DktN1NzE0LWMxMGYyZDIzOThmYjY5YT7m"
; $signature = base64_encode(hash_hmac('sha256',$salt,$secretKey,true));   $subject = "Test Ticket"; $fullname = "DropDeadDick"; $email = "test@domain.com"; $contents = "Test test test test"; $departmentid = "1"; $ticketstatusid = "1"; $ticketpriorityid = "1"; $tickettypeid = "1"; $staffid = "1";   $post_data = array('subject' => $subject, 'fullname' => $fullname, 'email' => $email, 'contents' => $contents, 'departmentid' => $departmentid, 'ticketstatusid' => $ticketstatusid, 'ticketpriorityid' => $ticketpriorityid, 'tickettypeid' => $tickettypeid, 'staffid' => $staffid, 'apikey' => $apiKey, 'salt' => $salt, 'signature' => $signature);   $post_data = http_build_query($post_data, '', '&');   $curl = curl_init($apiUrl); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_URL, $apiUrl); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);   $response = curl_exec($curl); curl_close($curl);   $xml = simplexml_load_string($response, 'SimpleXMLElement', LIBXML_NOCDATA); echo "<pre>".print_r($xml, true)."</pre>"; ?>

Snowing in Houston

It’s snowing here in Houston today! We don’t see snow that often here and it sure doesn’t compare to the snow when I am up in Michigan. However it is a welcome change and distraction from the normal Texas weather. It is expected to continue though the rest of the day and we may actually see more than 2 inches. I don’t mind at all, just gives me a reason to kick the dodge into 4 wheel drive.

Bookworm Addiction

I seemed to have a new found addiction to Bookworm. This is not a new game to me but I recently installed in on my notebook and can’t seem to stop playing it.

To make matters worse, Sharlet of SharletsWorld.com has been taunting me about my scores. I think I have her beat with my new score(3,452,580), but I really don’t see this ending well for me.

Edible Arrangement

I received an edible arrangement today from a friend for helping with her web design class. I have seen these before but never tried them nor received one until now. I enjoy fresh fruit but don’t eat it as often as I should, so this was a welcome treat.

Thanks Cathy!

My New “Desk”

My job requires a lot of hours at the keyboard, so I decide to swap my desk for something a bit more comfortable. After a little searching I opted for a recliner and a LCD stand.

To round out the setup, I tossed in a wireless keyboard, wireless mouse, and a nice lap board. My only complaints so far are that the stand is held in place by the weight of the recliner and I hate the keyboard. However, I have yet to knock it over and have pre ordered the new Logitech K340 compact keyboard.

Why Not?

I haven’t maintained a site in a while so I figured why not see how much of my life I can waste tweaking this damn thing. I have no idea what I will put up here but I can promise you it’s not going to be entertaining. So move on my friend or you will lose precious minutes of your life that you will never get back.