SOAP Example: “Hot Potatoe Reporting” – Part 1

Jens Bothe26. May 2010 | Best PracticesDevelopment

Disclaimer:

The practical examples presented in our technical blog (blog.otrs.com) and now in the expert category in our FAQ blog section serve as a source of ideas and documentation to show what is theoretically possible with OTRS in concrete scenarios or sometimes even for more exotic configurations. All configurations presented here were developed under laboratory conditions as a proof of concept. 

We can only guarantee testing and implementation of these concepts to be error-free and productive if implemented in a workshop with one of our OTRS consultants. Without this, the responsibility lies with the customer himself. Please note that configurations from older OTRS versions may not work in the newer ones.

The script will return the number of used queues per ticket. The number of moves is this number less 1.

You need to activate the SOAP Interface via SysConfig first!

#!/usr/bin/perl -w
# SOAP Config
use SOAP::Lite( 'autodispatch', proxy => 'http://otrsserver/otrs/rpc.pl' );
my $SOAP_User = 'otrs';
my $SOAP_Pass = 'test';

# getting TicketID
use Getopt::Std;
my %opts;
getopts( 'i:', \%opts );
if ( !$opts{i} ) {
    print STDERR "ERROR: Need -i TicketID\n";
    exit 1;
}
# SOAP script
my $RPC = Core->new();

my @QueueList = $RPC->Dispatch( $SOAP_User, $SOAP_Pass, 'TicketObject', 'MoveQueueList',
        TicketID => $opts{i},
        Type     => 'Name',
    );
my $TicketNumber = $RPC->Dispatch( $SOAP_User, $SOAP_Pass, 'TicketObject', 'TicketNumberLookup',
        TicketID => $opts{i},
    );
$QL = scalar @QueueList;
print "NOTICE: Ticket#$TicketNumber ($opts{i}) - number of moves is $QL\n";
exit 0;

Running it  will look like this:


jb$ ./rpc_getmove.pl -i 4
NOTICE: Ticket#2010010610000011 (4) - number of moves is 8

#3
Fabi at 25.10.2018, 20:00

Please, I'm newbee at otrs soap/rest connections. Can you help me? I tried run the script, but occurs the error: syntax error near unexpected token `(' `use SOAP::Lite( 'autodispatch', proxy => 'http://ip_address/otrs/rpc.pl' );' Thank you very very much! Regards, Fabi

#2
Jens Bothe at 27.05.2010, 08:35

Thanks for yor feedback, I fixed it

#1
Rotten at 27.05.2010, 00:34

I think the various '=&gt' should be '=>'

Your email address will not be published.