[rt-users] Rest Interface: Create New Ticket

John Johnston johnj at msu.edu
Tue Dec 4 17:12:54 EST 2012


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! http://bestpractical.com/jobs

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20121204/cffd318e/attachment.htm>


More information about the rt-users mailing list