Using API through Perl

Discussion and information for XML-RPC interface.

Moderators: Amaradana, TurboPT, TL Developers

Using API through Perl

Postby releppes » Fri Jan 29, 2010 9:19 pm

I just started using the XML-RCP API through Perl. There's no sample code, but here's the syntax I use.

Code: Select all

use XML::RPC;
use Data::Dumper;

my $xmlrpc = XML::RPC->new('http://.../lib/api/xmlrpc.php');

my $result = $xmlrpc->call('tl.reportTCResult', {
   devKey => '...',
   testcaseid => '...',
   testplanid => '...',
    status => '...',


My question is about obtaining testplanid using the API. I can get testcaseid using the getTestCaseIDByName routine, but there's no such routine for testplanid.

I'm running TestLink 1.8.2.

For what's it's worth, I do have a means to obtain the testprojectid and testplanid using the following routines, but I wanted to know if there was an easier method:

Code: Select all
my $testprojects = $xmlrpc->call('tl.getProjects', {devKey => $devKey});
my $testprojectname = "Test";
my $testproject;

for (@$testprojects) {
   $testproject = $_ if $_->{name} eq $testprojectname;


my $testplans = $xmlrpc->call('tl.getProjectTestPlans', {devKey => $devKey, testprojectid=>$testproject->{id}});
my $testplanname = "Regression";
my $testplan;

for (values(%{$testplans->[0]})) {
   $testplan = $_ if $_->{name} eq $testplanname;


my $testprojectid = $testproject->{id};
my $testplanid = $testplan->{id};
TestLink user
Posts: 2
Joined: Mon Dec 21, 2009 1:48 pm
Location: Rochester, NY

Postby austvik » Fri Apr 09, 2010 6:17 am


I don't think there is any easier way, so I'll encourage you to create a feature request in the tracker. If you can specify what the new function should do and which parameters it should take, that would be great.

Advanced user
Posts: 24
Joined: Thu Mar 25, 2010 7:25 am

Return to XML-RPC API

Who is online

Users browsing this forum: No registered users and 2 guests