Need help on how to add a support ticket via the API - I keep getting an error?

Need help on how to add a support ticket via the API - I keep getting an error?

HI,

I'm trying to add a support ticket using cURL via the API but I keep getting the following error 


1001Unable to process your request. Please verify whether you have entered proper method name,parameter and parameter values.

I have the code below. I'm sure I'm doing something wrong but the API documentation is really light in terms of examples and details.Am I messing up the XML? (I've removed the auth code and portal names form the code below)

  1. //Initialize connection 
  2.   $ch = curl_init('https://desk.zoho.com/api/xml/requests/addrecords?');
  3.   curl_setopt($ch, CURLOPT_VERBOSE, 1);//standard i/o streams 
  4.   curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);// Turn off the server and peer verification 
  5.   curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); 
  6.   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//Set to return data to string ($response) 
  7.   curl_setopt($ch, CURLOPT_POST, 1);//Regular post 
  8.   //Set post fields 
  9.   //this script is being proccessed by a form so I also put all of my $_POST['name'] variable here to be 
  10.   //used in the $xmlData variable below

  11.   $authtoken = "{auth code here}";

  12.   
  13.     $xmlData = "<tickets>
  14.                  <row no='1'>
  15.                      <fl val='Subject'>Subject Test</fl>
  16.                      <fl val='Contact Name'>Test API</fl>
  17.                      <fl val='Email'>nadeem@******</fl>
  18.                      <fl val='Description'>Description of issue</fl>
  19.                      <fl val='classification'>Classification of issue</fl>
  20.                  </row>
  21.              </tickets>";

  22.   $query = "authtoken={$authtoken}&xml={$xmlData}&portal={portal name here}&department=Support"; 
  23.   curl_setopt($ch, CURLOPT_POSTFIELDS, $query);// Set the request as a POST FIELD for curl. 
  24.   //Execute cUrl session 
  25.   $response = curl_exec($ch); 
  26.   curl_close($ch);