[rt-users] XML & RT
Howard Jones
howard.jones at network-i.net
Thu Jun 9 05:04:13 EDT 2005
Adrian Carter wrote:
> Can anyone point me towards some documentation of RT and XML?
>
> I wish to use XML to pull information into a customer management system
> and would like to know if there is something more current than the SOAP
> interface or if there is docs on the REST interface?
>
> Also, can someone point me towards a perl module that they have used to
> manipulate RT XML data. is XML::Simple sufficent?
Must it be XML? Those three questions together kind of imply that all
you really want is any kind of interface, and XML is the trendy way to
do it... don't mean to sound rude.
The different perl XML modules vary wildly in what they do - it really
really depends on exactly what you need. Do you need to work with an
existing DTD, or have files produced to match some existing output (for
some program that has a limited parser, say)? XML::Simple is fiddly for
that. It's fine for just reading stuff in though, or for when you are
the only consumer of your data. I found perl & XML to be pretty
frustrating last time I wanted to do something with it, and ended up
using VB.net and some XPath stuff which got it done in an hour. YMMV,
and it was about a year ago now.
I'd like to know the answer to #2 myself - I think there's a lot that
could be done using the REST interface if you could work out how. We
have a provisioning database which allows tickets to be created from
within it's web interface, and when tickets are closed in RT, the
corresponding record in the provisioning database is also updated. That
uses the NoAuth mail gateway to submit tickets, and a custom Scrip to
update the other way.
In case it's of use to anyone:
In the provisioning DB:
<form target="RT_crosswindow"
action="http://www.company.com/rt/REST/1.0/NoAuth/mail-gateway"
method="POST">
<input type=SUBMIT value="Create RT Ticket"><input type=HIDDEN
name="queue" value="9">
<TEXTAREA NAME="message" COLS=70 ROWS=6>From: requestor at customer.co.uk
Subject: Customer ID xyz
Queue: broadband
X-DBReference: 5522545
</TEXTAREA>
</form>
(I never did get around to making it a hidden field - the idea was to
have just one button).
In RT, for the appropriate queue:
We use Extract Custom Field Values, to put that X-DBReference: header
into a Custom Field. Then,
On Create, run the following custom action to tell the PDB that there's
a ticket open, and what it's ID is:
if($self->TicketObj->FirstCustomFieldValue('DBReference') ne "")
{
use LWP::Simple qw(get);
my $dbref = $self->TicketObj->FirstCustomFieldValue('DBReference');
my $state = $self->TransactionObj->NewValue;
my $id = $self->TicketObj->id;
get("http://intranet.company.com/api/update-trouble-ticket.php?NewState=".$state."&DBReference=".$dbref."&TicketID=".$id);
}
On Status Change, running the following custom action to tell the PDB
that the ticket has closed:
if($self->TicketObj->FirstCustomFieldValue('DBReference') ne "")
{
use LWP::Simple qw(get);
my $dbref = $self->TicketObj->FirstCustomFieldValue('DBReference');
my $state = $self->TransactionObj->NewValue;
my $id = $self->TicketObj->id;
get("http://intranet.company.com/api/update-trouble-ticket.php?NewState=".$state."&DBReference=".$dbref."&TicketID=".$id);
}
Obviously, there's a PHP script on the other side, that's actually
updating the database.
None of which answers your question, but it's maybe slightly useful :-)
Best Regards,
Howard
More information about the rt-users
mailing list