Rest Interface: Create New Ticket

Hello,

I’ve been reviewing the sectionhttp://requesttracker.wikia.com/wiki/REST#Interface on how to create a new ticket through the REST interface. Could you give me an example on how the following instruction would be implemented in Perl?

To create a new ticket: post on /REST/1.0/ticket/new with a variable named “content”, containing “key: value” line by line

Thanks,
Angel

We are using something like this:

my $ticket = RT::Client::REST::Ticket->new(
rt => $rt,
queue => “General”,
subject => “$your_subject”,
status => “new”,
requestor => [$your_netid],
cf => {
‘public’ => $your_public,
},
)->store(text => “$your_comments”);

Where $your_subject, $your_netid, $your_public, and $your_comments are
returned by the form once submit is pushed. Note that “requestor” is
submitted as an array type object. “cf” is a custom field. You’ll
also need some sort of “login” section placed beforehand, and an
identification of the server/interface to use. For instance:

my $rt = RT::Client::REST->new(
server => ($ENV{RTSERVER} || ‘http://your.rt.domain.com’),
);

 $rt->login(
 username=> "yourAdmin",
 password=> "yourPass",
 );

So you create the RT object $rt, login to it, and then create your ticket.

Hope that helps.

J.On 12/4/12 4:17 PM, Vega, Angel L. wrote:

Hello,

I’ve been reviewing the section
http://requesttracker.wikia.com/wiki/REST#Interface on how to create
a new ticket through the REST interface. Could you give me an example
on how the following instruction would be implemented in Perl?

/To create a new ticket: post on /|//REST/1.0/ticket/new/|/with a
variable named “/|/content/|/”, containing “/|/key: value/|/” line by
line/

Thanks,

Angel


We’re hiring! Careers — Best Practical Solutions