[rt-users] HTML Comments with RT REST Interface
Roman Plessl
roman.plessl at oetiker.ch
Sun Apr 17 19:54:04 EDT 2011
Hi Everybody,
I'm using the REST interface of a large RT 3.8.8 installation to
communicate and fill in data from a CRM tool.
Is there a possibility to insert HTML comments instead of plain text
comments with this REST interface?
Does anybody has an example for doing this?
One of the ways I have tried - but unfortunatly not sucessfully - was to
patch the RT-Client-REST 0.41 code. I have added a MIME::Entity called
MIMEObj including the HTML comment and passing this through the REST call.
But my additional ticket comments added with this new code parts are
always text/plain comments in RT (Interface and DB).
Here are my parts of the patched RT::Client::REST.pm
+use MIME::Entity;
...
+sub MakeMIMEEntity () # taken from RT::Interface::Web
...
sub comment {
my $msg = $self->_valid_comment_message(delete($opts{message}));
my @objects = ("Ticket", "Action", "Text");
my %values = (
Ticket => $ticket_id,
Action => $action,
Text => $msg,
);
+ if ($opts{'mimeType'} and $opts{'mimeType'} eq 'text/html') {
+ my $MIMEObj = MakeMIMEEntity(
+ Subject => "Hello HTML Comment!",
+ Body => $msg,
+ Type => 'text/html',
+ );
+
+ push @objects, "MIMEObj";
+ $values{MIMEObj} = $MIMEObj->as_string;
+ }
+
my $text = form_compose([[ '', \@objects, \%values, ]]);
$data{content} = $text;
$self->_submit("ticket/$ticket_id/comment", \%data);
return;
}
...
Help is greatly appreciated.
Thanks in advance!
Best regards, Roman
--
Roman Plessl
OETIKER+PARTNER AG
Aarweg 15
CH-4600 Olten
More information about the rt-users
mailing list