[rt-devel] using REST to create ticket//Error # Could not create ticket. Can't use an undefined value as an ARRAY reference

Lin, Kun LINA at cua.edu
Thu Jan 19 16:39:37 EST 2012


When I try to post data to RT using REST to create a new ticket, I receive these error message:

Can't use an undefined value as an ARRAY reference at /usr/share/request-tracker3.8/html/REST/1.0/dhandler line 189. Stack: [/usr/share/request-tracker3.8/html/REST/1.0/dhandler:189] [/usr/share/request-tracker3.8/html/REST/1.0/autohandler:54] [/usr/share/request-tracker3.8/lib/RT/Interface/Web.pm:353] [/usr/share/request-tracker3.8/lib/RT/Interface/Web.pm:226] [/usr/share/request-tracker3.8/html/autohandler:53] 1



Here is my code in PHP


$arrfield = array("id"=>"ticket/new", "Requestor"=>"***", "Subject"=>"Test", "Status"=>"new", "Priority"=>"0","InitialPriority"=>"0","Starts"=>"2012-01-19 15:51:30","Text"=>"This is a test","Queue"=>"360_Link");


$url = 'http://cutest.wrlc.org/rt/REST/1.0/ticket/new';
$fields = array(                  'user'=>'***',
                                                'pass'=>'***',
                                                'content'=>json_encode($arrfield)
                );

$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields);
$result = curl_exec($ch);
echo $result;
curl_close($ch);


Thanks
Kun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-devel/attachments/20120119/80caddca/attachment.html>


More information about the rt-devel mailing list