Quantcast
Channel: THWACK: Message List
Viewing all articles
Browse latest Browse all 20490

Create Ticket via API

$
0
0

Here is my little test code to try to create a ticket. I get the following in return "Your request produced an error." Ideas?

 

<?php

function http_response($url, $data)

{

  $data = json_encode($data);

 

  $ch = curl_init();

  curl_setopt($ch, CURLOPT_URL, $url);

  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");

  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);                                                                  

  curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

  curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);

  curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                         

     'Content-Type: application/json',                                                                               

     'Content-Length: ' . strlen($data_string))                                                                      

  ); 

 

 

  $head = curl_exec($ch);

  $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

  curl_close($ch);

  print_r($head);

}

 

$data = array(

  'problemtype' => array(

  'id'=>24,

  'type'=>'RequestType'),

  'subject' => 'API Test',

  'detail' => "This is a test of the Help Desk API",

  'sendEmail' => false,

  'clientReporter' => array(

  'id' => 5353,

  'type' => 'Client'),

  'statustype'=> array(

  'type' => 'StatusType',

  'id'=>1 ),

  'prioritytype' => array (

  'type' => 'PriorityType',

  'id' => 1),

);

 

http_response("https://URL/helpdesk/WebObjects/Helpdesk.woa/ra/Tickets?apiKey=*******", $data);

 

?>


Viewing all articles
Browse latest Browse all 20490

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>