Getting a HTTP POST to return info on the created ticket

Hi,

We are using RT 3.8.1

I am a definitely a RT newbie but have managed to generate a number of
CGI forms that end up submitting an RT ticket into RT using the HTTP
POST method. Works great. However the only response I appear to get back
is the HTTP success status code. Nothing else.

I would love the POST operation to return back the RT number for the ticket
I have created. This would allow me to attach the RT ticket number to other
files, logs and SVN operations the CGI scripts mess with.

How do I get the HTTP POST to return information on the created ticket.

Thanks in advance. Fergus.

– IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

I am a definitely a RT newbie but have managed to generate a number of
CGI forms that end up submitting an RT ticket into RT using the HTTP
POST method. Works great. However the only response I appear to get back
is the HTTP success status code. Nothing else.

I would love the POST operation to return back the RT number for the ticket
I have created. This would allow me to attach the RT ticket number to other
files, logs and SVN operations the CGI scripts mess with.

How do I get the HTTP POST to return information on the created ticket.

What URL are you posting to? Are you using the REST interface or the
normal web interface?

I am a definitely a RT newbie but have managed to generate a number of
CGI forms that end up submitting an RT ticket into RT using the HTTP
POST method. Works great. However the only response I appear to get back
is the HTTP success status code. Nothing else.

I would love the POST operation to return back the RT number for the ticket
I have created. This would allow me to attach the RT ticket number to other
files, logs and SVN operations the CGI scripts mess with.

How do I get the HTTP POST to return information on the created ticket.

What URL are you posting to? Are you using the REST interface or the
normal web interface?

Hmm, not sure. I thought I was using the POST interface. As far as RT
is concerned is POST The same as REST?

my $ua = LWP::UserAgent->new;
$ua->credentials( $RThost, 'OUR Internal Request System', $RTusername, $RTpassword );
my $response = $ua->post(
    "http://$RThost/SelfService/Create.html",
    'Content_Type' => 'form-data',
    'Content'      => [
        'id'                                              => "new",
        'Queue'                                           => $RTqueue,
        'Requestors-Value'                                => $ENV{"REMOTE_USER"},
        'Cc-Value'                                        => join( ",", @recipients ),
        'Subject'                                         => $RTsubject,
        'ContentType'                                     => "text/plain;charset='utf-8'",
        'Content'                                         => join( "", @message ),
        'ArmPriority'                                     => "ST",
        'ArmPriorityDue'                                  => "",
        'ArmPSJustify'                                    => "",
        'FCKeditorEncoded'                                => "1",
        'Object-RT::Ticket--CustomField-101-Values-Magic' => "1",
        'Object-RT::Ticket--CustomField-101-Values'       => "Normal",
        'Object-RT::Ticket--CustomField-102-Values-Magic' => "1",
        'Object-RT::Ticket--CustomField-102-Values'       => "DocSupport",
        'Attach'                                          => [
            undef,
            '',
            'Content-Type' => "application/octet-stream",
            'Content'      => "",
            ],
          ]
      );

– IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

Hmm, not sure. I thought I was using the POST interface. As far as RT
is concerned is POST The same as REST?

POST is a generic HTTP verb, not an interface. You’re POSTing (making
an HTTP request) to the normal RT self service pages designed for end
users, not custom scripts.

You probably want to use the REST endpoints RT provides, otherwise you
get to parse the response headers or HTML for the ticket number and errors.

http://wiki.bestpractical.com/view/REST

my $ua = LWP::UserAgent->new;
$ua->credentials( $RThost, 'OUR Internal Request System', $RTusername, $RTpassword );
my $response = $ua->post(
    "http://$RThost/SelfService/Create.html",

[snip]

Have you looked at $response->decoded_content? Read perldoc HTTP::Response for what $response is.