API problems

API problems

Hi guys, I'm having a problem with the API trying to create a ticket. I'm just getting the response 
  1. array(1) { ["message"]=> string(35) "Error while processing your request" } array(26) { ["url"]=> string(36) "https://desk.zoho.com/api/v1/tickets" ["content_type"]=> string(30) "application/json;charset=UTF-8" ["http_code"]=> int(500) ... }
which doesn't shed much light on what the problem is. I have tried running a post request on the same url ( https://desk.zoho.com/api/v1/tickets) from a request making tool and it has the exact same problems as my PHP script.

  1. $url="https://desk.zoho.com/api/v1/tickets";
  2. $ch = curl_init();
  3. curl_setopt($ch, CURLOPT_POST, 1);
  4. curl_setopt($ch, CURLOPT_URL, $url);
  5. curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  6.     "Authorization:$token",
  7. "orgId:$orgid",
  8. "Content-Type:application/json"
  9. ));
  10. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  11. $data = array(
  12. "contactId"=>$zhid,
  13. "subject"=>"Testing",
  14. "description"=>"Testing ticket",
  15. "status"=>"Open",
  16. "departmentId"=>"77694000000006907"
  17. );
  18. curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
  19. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
  20. curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  21. $result = curl_exec($ch);

Any help is much appreciated :)