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)
- //Initialize connection
- $ch = curl_init('https://desk.zoho.com/api/xml/requests/addrecords?');
- curl_setopt($ch, CURLOPT_VERBOSE, 1);//standard i/o streams
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);// Turn off the server and peer verification
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//Set to return data to string ($response)
- curl_setopt($ch, CURLOPT_POST, 1);//Regular post
- //Set post fields
- //this script is being proccessed by a form so I also put all of my $_POST['name'] variable here to be
- //used in the $xmlData variable below
- $authtoken = "{auth code here}";
-
- $xmlData = "<tickets>
- <row no='1'>
- <fl val='Subject'>Subject Test</fl>
- <fl val='Contact Name'>Test API</fl>
- <fl val='Email'>nadeem@******</fl>
- <fl val='Description'>Description of issue</fl>
- <fl val='classification'>Classification of issue</fl>
- </row>
- </tickets>";
- $query = "authtoken={$authtoken}&xml={$xmlData}&portal={portal name here}&department=Support";
- curl_setopt($ch, CURLOPT_POSTFIELDS, $query);// Set the request as a POST FIELD for curl.
- //Execute cUrl session
- $response = curl_exec($ch);
- curl_close($ch);