Differences between revisions 1 and 21 (spanning 20 versions)
Revision 1 as of 2007-06-24 11:56:34
Size: 479
Editor: ?BastianVenthur
Comment:
Revision 21 as of 2008-02-19 23:10:58
Size: 7342
Editor: SandroTosi
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
This documentation will likely always be slightly behind the extant
documentation in the Debbugs::SOAP module. However, feel free to
update it when they begin to differ.
Line 7: Line 11:
http://bugs.debian.org/cgi-bin/soap.cgi is the official SOAP interface for Debian's BTS.

http://bugs.donarmstrong.com/cgi-bin/soap.cgi is the development version.

The namespace is Debbugs/SOAP
{{{http://bugs.debian.org/cgi-bin/soap.cgi}}} is the official SOAP interface for Debian's BTS.

{{{http://bugs.donarmstrong.com/cgi-bin/soap.cgi}}} is the development version.

The namespace is {{{Debbugs/SOAP}}}
Line 14: Line 18:
 get_status:: returns foo
 get_bugs:: returns bar

http://bugs.debian.org/debbugs-source/mainline/Debbugs/SOAP.pm

 get_status(bugnumber [, bugnumber]*):: returns the status of the given bugs
 get_bugs(key, value[, key, value]*):: returns bugs that match the conditions given by key-value pair. Possible keys: package, submitter, maint, src, severity, status, tag, owner, bugs.
 get_usertag(email [, tag]*):: returns bugs tagged by the email. All of them, or only those tagged with the selected tags, if tags are explicitly given.
 get_bug_log(bugnumber):: returns the whole bug log, divided in headers and bodies.
 newest_bugs(amount):: returns a list of the newest bugs.
Line 18: Line 28:

http://bzr.donarmstrong.com/debbugs/source/Debbugs/SOAP.pm

Currently the same as the one in bugs.debian.org

== Examples ==

=== Perl ===
{{{
#!/usr/bin/perl

use warnings;
use strict;

use Data::Dumper;
use SOAP::Lite;

my $soap = SOAP::Lite->uri('Debbugs/SOAP')->proxy('http://bugs.debian.org/cgi-bin/soap.cgi');
print Dumper($soap->get_bugs(package=>debbugs)->result());
print Dumper($soap->get_status(400000)->result());
print Dumper($soap->get_status(400000)->result());
# et al.
}}}

{{{
#!/usr/bin/env perl
# get all the bugs tagged with a certain usertag for a package
use SOAP::Lite;
use Data::Dumper;

my $c = new SOAP::Lite->uri('/Debbugs/SOAP')->proxy('http://bugs.debian.org/cgi-bin/soap.cgi');
my $usertags = my $usertags = $c->get_usertag('debian-qa@lists.debian.org')->result();
my $bugs = $c->get_bugs(usertags=>$usertags,tag=>'qa-ftbfs-20070708',package=>'tilp')->result();
print Dumper($bugs);
}}}

{{{
#!/usr/bin/env perl
# get all bugs for a given usertag and then select the bug for a
# certain package. Same as above probably a bit faster at times.
# $inf will contain all information about the bug such as
# subject, tags, severity ...
use SOAP::Lite;
use Data::Dumper;
my $c = new SOAP::Lite->uri('/Debbugs/SOAP')->proxy('http://bugs.debian.org/cgi-bin/soap.cgi');
my $bugs = $c->get_usertag('debian-qa@lists.debian.org','qa-ftbfs-20070708')->result;
my $bug = $c->get_bugs('bugs', $bugs->{'qa-ftbfs-20070708'}, 'package', 'tilp')->result;


my $inf = $c->get_status($bug)->result;
print Dumper($inf);
}}}

The following example was provided by DavidMorenoGarza:

{{{
# [...] snip [...]

my $soap = SOAP::Lite->uri('Debbugs/SOAP')->proxy('http://bugs.donarmstrong.com/cgi-bin/soap.cgi');

my $latest_bug = $soap->newest_bugs(1)->result();

print "Latest bug: $latest_bug->[0]\n";

if($cache > $latest_bug->[0]) {
  print "No news.\n";
  $_[KERNEL]->delay(soap_check => $delay);
  return;
}

my $rc_bugs = $soap->get_bugs(
  bugs => [$cache..$latest_bug->[0]],
  severity => [qw(serious grave critical)]
)->result();

foreach my $bug(sort @$rc_bugs) {
  my $text = "#$bug: ";
  my $info = $soap->get_status($bug)->result->{$bug};
  $text .= $info->{subject};
  $text .= " - package: $info->{package}";
  $text .= " - severity: $info->{severity}";
  $text .= " - tags: $info->{tags}" if $info->{tags};
  $text .= " - date: ".scalar(gmtime($info->{date}));
  $text .= " - submitter: $info->{originator}";
  $text .= " - http://bugs.debian.org/$bug";
  $irc->yield(notice => $channel, $text);
}
}}}

=== Python ===
{{{
#!python
#!/usr/bin/env python


import SOAPpy

url = 'http://bugs.debian.org/cgi-bin/soap.cgi'
namespace = 'Debbugs/SOAP'
server = SOAPpy.SOAPProxy(url, namespace)

# some debug output
#server.config.dumpSOAPOut = 1
#server.config.dumpSOAPIn = 1


def getStatus(*args):
        result = server.get_status(*args)
        return result

def getBugs(*args):
        result = server.get_bugs(*args)
        return result

def getBugLog(*args):
        result = server.get_bug_log(*args)
        return result


# All bugs from one package (returns a list of bugnumbers)
print getBugs("package", "gtk-qt-engine")

# All bugs of a maintainer
print getBugs("maint", "<place an email address here>")

# returns the status of those bugs
print getStatus(409909, 419920, 421581, 417044, 397993)

# getStatus and getBugs combined:
getStatus(getBugs("package", "gtk-qt-engine"))

# returns the full log for the given bug number
print getBugLog(202526)

}}}

=== Ruby ===

{{{
#!/usr/bin/ruby
require 'soap/rpc/driver'

host = "bugs.debian.org"
port = 80
server="http://#{host}:#{port}/cgi-bin/soap.cgi"
ns = 'Debbugs/SOAP/'
drv = SOAP::RPC::Driver.new(server, ns)
drv.wiredump_dev = STDOUT if $DEBUG
drv.add_method('get_status','bugnumber')
drv.add_method('get_bugs','keyparam')

p drv.get_status(drv.get_bugs(['package', 'pbuilder', 'severity', 'wishlist']))
}}}

== PHP ==

{{{
<?php
$client = new SoapClient(NULL,
 array('location' => "http://bugs.debian.org/cgi-bin/soap.cgi",
 'uri' => "Debbugs/SOAP",
 'proxy_host' => "http://bugs.debian.org"));
$response = $client->__soapCall("get_status", array('bug'=>$bugnumber));
$obj = $response[$bugnumber];

?>
<table border=1>
    <tr>
        <td>Originator
        </td>
        <td><?php echo $obj->originator?></td>
    </tr>
    <tr>
      <td>Found in</td>
      <td><?php echo implode(" ",$obj->found_versions); ?></td>
    </tr>
</table>

}}}

Use var_dump to get the full list of variables available:
{{{
var_dump($obj);
}}}

To get details of all bugs with a specific usertag (in this case, crossbuilt):
{{{
<?php
$tag = 'crossbuilt';
$email='codehelp@debian.org';
$client = new SoapClient(NULL,
 array('location' => "http://bugs.debian.org/cgi-bin/soap.cgi",
 'uri' => "Debbugs/SOAP",
 'proxy_host' => "http://bugs.debian.org"));
$response = $client->__soapCall("get_usertag", array('email'=>$email,'tag'=>$tag));
$obj_list = ($response->$tag);
while ($obj_list)
{
$bugnumber = array_pop($obj_list);
$bugresponse = $client->__soapCall("get_status", array('bug'=>$bugnumber));
$bugobj = $bugresponse[$bugnumber];
echo "<pre>";
echo "Number: $bugnumber\n";
echo "Subject: $bugobj->subject\n";
echo "Package: $bugobj->package\n";
echo "Originator: $bugobj->originator\n";
$bugdate = date("c", $bugobj->date);
echo "Date: $bugdate\n";
$modified = date("c", $bugobj->log_modified);
echo "Modified: $modified\n";
if ($bugobj->done) { echo "Done: $bugobj->done\n"; }
if ($bugobj->fixed) { echo "Done: $bugobj->fixed\n"; }
$found = implode(" ",$bugobj->found_versions);
echo "Found in: $found\n";
if ($bugobj->fixed_versions)
{
 $fixed_ver = implode (" ", $bugobj->fixed_versions);
 echo "Fixed in: $fixed_ver\n";
}
if ($bugobj->mergedwith)
{
 $merged = implode (" ", $bugobj->mergedwith);
 echo "Merged with: $merged\n";
}
echo "</pre>";
}
?>
}}}

== FAQ ==

Debbugs' SOAP Interface Documentation

This documentation will likely always be slightly behind the extant documentation in the Debbugs::SOAP module. However, feel free to update it when they begin to differ.

Please help to keep this documentation up to date!

URL and Namespace

http://bugs.debian.org/cgi-bin/soap.cgi is the official SOAP interface for Debian's BTS.

http://bugs.donarmstrong.com/cgi-bin/soap.cgi is the development version.

The namespace is Debbugs/SOAP

Available methods for bugs.debian.org

http://bugs.debian.org/debbugs-source/mainline/Debbugs/SOAP.pm

get_status(bugnumber [, bugnumber]*)
returns the status of the given bugs
get_bugs(key, value[, key, value]*)
returns bugs that match the conditions given by key-value pair. Possible keys: package, submitter, maint, src, severity, status, tag, owner, bugs.
get_usertag(email [, tag]*)
returns bugs tagged by the email. All of them, or only those tagged with the selected tags, if tags are explicitly given.
get_bug_log(bugnumber)
returns the whole bug log, divided in headers and bodies.
newest_bugs(amount)
returns a list of the newest bugs.

Available methods for bugs.donarmstrong.com

http://bzr.donarmstrong.com/debbugs/source/Debbugs/SOAP.pm

Currently the same as the one in bugs.debian.org

Examples

Perl

use warnings;
use strict;

use Data::Dumper;
use SOAP::Lite;

my $soap = SOAP::Lite->uri('Debbugs/SOAP')->proxy('http://bugs.debian.org/cgi-bin/soap.cgi');
print Dumper($soap->get_bugs(package=>debbugs)->result());
print Dumper($soap->get_status(400000)->result());
print Dumper($soap->get_status(400000)->result());
# et al.

# get all the bugs tagged with a certain usertag for a package
use SOAP::Lite;
use Data::Dumper;

my $c = new SOAP::Lite->uri('/Debbugs/SOAP')->proxy('http://bugs.debian.org/cgi-bin/soap.cgi');
my $usertags = my $usertags = $c->get_usertag('debian-qa@lists.debian.org')->result();
my $bugs =  $c->get_bugs(usertags=>$usertags,tag=>'qa-ftbfs-20070708',package=>'tilp')->result();
print Dumper($bugs);

# get all bugs for a given usertag and then select the bug for a
# certain package. Same as above probably a bit faster at times.
# $inf will contain all information about the bug such as
# subject, tags, severity ...
use SOAP::Lite;
use Data::Dumper;
my $c = new SOAP::Lite->uri('/Debbugs/SOAP')->proxy('http://bugs.debian.org/cgi-bin/soap.cgi');
my $bugs = $c->get_usertag('debian-qa@lists.debian.org','qa-ftbfs-20070708')->result;
my $bug = $c->get_bugs('bugs', $bugs->{'qa-ftbfs-20070708'}, 'package', 'tilp')->result;


my $inf = $c->get_status($bug)->result;
print Dumper($inf);

The following example was provided by DavidMorenoGarza:

# [...] snip [...]

my $soap = SOAP::Lite->uri('Debbugs/SOAP')->proxy('http://bugs.donarmstrong.com/cgi-bin/soap.cgi');

my $latest_bug = $soap->newest_bugs(1)->result();

print "Latest bug: $latest_bug->[0]\n";

if($cache > $latest_bug->[0]) {
  print "No news.\n";
  $_[KERNEL]->delay(soap_check => $delay);
  return;
}

my $rc_bugs = $soap->get_bugs(
  bugs => [$cache..$latest_bug->[0]],
  severity => [qw(serious grave critical)]
)->result();

foreach my $bug(sort @$rc_bugs) {
  my $text = "#$bug: ";
  my $info = $soap->get_status($bug)->result->{$bug};
  $text .= $info->{subject};
  $text .= " - package: $info->{package}";
  $text .= " - severity: $info->{severity}";
  $text .= " - tags: $info->{tags}" if $info->{tags};
  $text .= " - date: ".scalar(gmtime($info->{date}));
  $text .= " - submitter: $info->{originator}";
  $text .= " - http://bugs.debian.org/$bug";
  $irc->yield(notice => $channel, $text);
}

Python

   1 #!/usr/bin/env python
   2 
   3 
   4 import SOAPpy
   5 
   6 url = 'http://bugs.debian.org/cgi-bin/soap.cgi'
   7 namespace = 'Debbugs/SOAP'
   8 server = SOAPpy.SOAPProxy(url, namespace)
   9 
  10 # some debug output
  11 #server.config.dumpSOAPOut = 1
  12 #server.config.dumpSOAPIn = 1
  13 
  14 
  15 def getStatus(*args):
  16         result = server.get_status(*args)
  17         return result
  18 
  19 def getBugs(*args):
  20         result = server.get_bugs(*args)
  21         return result
  22 
  23 def getBugLog(*args):
  24         result = server.get_bug_log(*args)
  25         return result
  26 
  27 
  28 # All bugs from one package (returns a list of bugnumbers)
  29 print getBugs("package", "gtk-qt-engine")
  30 
  31 # All bugs of a maintainer
  32 print getBugs("maint", "<place an email address here>")
  33 
  34 # returns the status of those bugs
  35 print getStatus(409909, 419920, 421581, 417044, 397993)
  36 
  37 # getStatus and getBugs combined:
  38 getStatus(getBugs("package", "gtk-qt-engine"))
  39 
  40 # returns the full log for the given bug number
  41 print getBugLog(202526)

Ruby

require 'soap/rpc/driver'

host = "bugs.debian.org"
port = 80
server="http://#{host}:#{port}/cgi-bin/soap.cgi"
ns = 'Debbugs/SOAP/'
drv = SOAP::RPC::Driver.new(server, ns)
drv.wiredump_dev = STDOUT if $DEBUG
drv.add_method('get_status','bugnumber')
drv.add_method('get_bugs','keyparam')

p drv.get_status(drv.get_bugs(['package', 'pbuilder', 'severity', 'wishlist']))

PHP

<?php
$client = new SoapClient(NULL,
        array('location'     => "http://bugs.debian.org/cgi-bin/soap.cgi",
        'uri'     => "Debbugs/SOAP",
        'proxy_host'  => "http://bugs.debian.org"));
$response = $client->__soapCall("get_status", array('bug'=>$bugnumber));
$obj = $response[$bugnumber];

?>
<table border=1>
    <tr>
        <td>Originator
        </td>
        <td><?php echo $obj->originator?></td>
    </tr>
    <tr>
      <td>Found in</td>
      <td><?php echo implode(" ",$obj->found_versions); ?></td>
    </tr>
</table>

Use var_dump to get the full list of variables available:

var_dump($obj);

To get details of all bugs with a specific usertag (in this case, crossbuilt):

<?php
$tag = 'crossbuilt';
$email='codehelp@debian.org';
$client = new SoapClient(NULL,
        array('location'     => "http://bugs.debian.org/cgi-bin/soap.cgi",
        'uri'     => "Debbugs/SOAP",
        'proxy_host'  => "http://bugs.debian.org"));
$response = $client->__soapCall("get_usertag", array('email'=>$email,'tag'=>$tag));
$obj_list = ($response->$tag);
while ($obj_list)
{
$bugnumber = array_pop($obj_list);
$bugresponse = $client->__soapCall("get_status", array('bug'=>$bugnumber));
$bugobj = $bugresponse[$bugnumber];
echo "<pre>";
echo "Number: $bugnumber\n";
echo "Subject: $bugobj->subject\n";
echo "Package: $bugobj->package\n";
echo "Originator: $bugobj->originator\n";
$bugdate = date("c", $bugobj->date);
echo "Date: $bugdate\n";
$modified = date("c", $bugobj->log_modified);
echo "Modified: $modified\n";
if ($bugobj->done) { echo "Done: $bugobj->done\n"; }
if ($bugobj->fixed) { echo "Done: $bugobj->fixed\n"; }
$found = implode(" ",$bugobj->found_versions);
echo "Found in: $found\n";
if ($bugobj->fixed_versions)
{
        $fixed_ver = implode (" ", $bugobj->fixed_versions);
        echo "Fixed in: $fixed_ver\n";
}
if ($bugobj->mergedwith)
{
        $merged = implode (" ", $bugobj->mergedwith);
        echo "Merged with: $merged\n";
}
echo "</pre>";
}
?>

FAQ