by Isaac on March 3rd, 2010
I’ve been working on a perl based Jira SOAP perl script to add versions to a project. thought i would share

 Perl |  copy code |? 
01
#!/usr/bin/perl
02
use SOAP::Lite;
03
 
04
my $username = "ijohnson";
05
my $password = 'password';
06
 
07
#this took a bit.  the ID i know is 10000
08
#so i kept trying to push that, but it wants the short textual name (for the QA group here it's TEST)
09
#e.g. http://10.10.10.172:8080/jira/browse/TEST
10
my $projectNum = "TEST"; #10000
11
 
12
#for reference, jira is exposed like http://10.10.10.172:8080/jira/secure/Dashboard.jspa
13
my $soap = SOAP::Lite->proxy("http://10.10.10.172:8080/jira/rpc/soap/jirasoapservice-v2?wsdl");
14
 
15
my $auth = $soap->login(
16
SOAP::Data->type(string => $username),
17
SOAP::Data->type(string => $password)
18
);
19
 
20
#Example one (releaseDate is optional).
21
my %versionInfo = ( 'name' => '2.7.37.11',
22
'releaseDate' => "2010-03-02T00:00:00.000Z");
23
my $newVersion = $soap->addVersion($auth->result(),
24
$projectNum,
25
\%versionInfo);
26
 
27
#Example two
28
 
29
# note:
30
# releaseDate => SOAP::Data->type(string => "2010-03-02T00:00:01.000Z"),
31
# didnt work, someone can probably fix this example.  works without releaseDate though
32
my $versionInfo2 = {
33
name => SOAP::Data->type(string => "2.7.37.12"),
34
};
35
my $newVersion = $soap->addVersion($auth->result(),
36
$projectNum,
37
$versionInfo2);
38
 
39
#example three
40
my $vName = "2.7.37.13";
41
my $rDate = "2010-03-02T00:00:03.000Z";
42
 
43
my $newVersion = $soap->addVersion($auth->result(),
44
$projectNum,
45
SOAP::Data->type(
46
versionInfo => {
47
name => $vName,
48
releaseDate => $rDate
49
},
50
)
51
);
52
 
53
exit 0;

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS