summaryrefslogtreecommitdiffstats
path: root/extensions/BzAPI/lib
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2014-08-26 21:45:40 +0200
committerDavid Lawrence <dkl@mozilla.com>2014-08-26 21:45:40 +0200
commitb888aaa25fd0775e022e196ed8f56e766e766098 (patch)
treed7dbd977106816c113a3e3740c07dc0274743b5a /extensions/BzAPI/lib
parentbfc1cfe2b6f723b260d90363b7eccbb8e3297f89 (diff)
downloadbugzilla-b888aaa25fd0775e022e196ed8f56e766e766098.tar.gz
bugzilla-b888aaa25fd0775e022e196ed8f56e766e766098.tar.xz
Bug 1057774: bzAPI landing page gives a 404
Diffstat (limited to 'extensions/BzAPI/lib')
-rw-r--r--extensions/BzAPI/lib/Constants.pm5
-rw-r--r--extensions/BzAPI/lib/Resources/Bugzilla.pm20
2 files changed, 25 insertions, 0 deletions
diff --git a/extensions/BzAPI/lib/Constants.pm b/extensions/BzAPI/lib/Constants.pm
index c36543daf..65ae00480 100644
--- a/extensions/BzAPI/lib/Constants.pm
+++ b/extensions/BzAPI/lib/Constants.pm
@@ -17,6 +17,8 @@ our @EXPORT = qw(
ATTACHMENT_FIELD_MAP
DEFAULT_BUG_FIELDS
DEFAULT_ATTACHMENT_FIELDS
+
+ BZAPI_DOC
);
# These are fields that are normally exported as a single value such
@@ -147,4 +149,7 @@ use constant ATTACHMENT_FIELD_MAP => {
'type' => 'content_type',
};
+# A base link to the current BzAPI Documentation.
+use constant BZAPI_DOC => 'https://wiki.mozilla.org/Bugzilla:BzAPI';
+
1;
diff --git a/extensions/BzAPI/lib/Resources/Bugzilla.pm b/extensions/BzAPI/lib/Resources/Bugzilla.pm
index 6c436e861..26aae0849 100644
--- a/extensions/BzAPI/lib/Resources/Bugzilla.pm
+++ b/extensions/BzAPI/lib/Resources/Bugzilla.pm
@@ -17,6 +17,9 @@ use Bugzilla::Keyword;
use Bugzilla::Product;
use Bugzilla::Status;
use Bugzilla::Field;
+use Bugzilla::Util qw(correct_urlbase);
+
+use Bugzilla::Extension::BzAPI::Constants;
use Digest::MD5 qw(md5_base64);
@@ -27,10 +30,18 @@ use Digest::MD5 qw(md5_base64);
BEGIN {
require Bugzilla::WebService::Bugzilla;
*Bugzilla::WebService::Bugzilla::get_configuration = \&get_configuration;
+ *Bugzilla::WebService::Bugzilla::get_empty = \&get_empty;
}
sub rest_handlers {
my $rest_handlers = [
+ qr{^/$}, {
+ GET => {
+ resource => {
+ method => 'get_empty'
+ }
+ }
+ },
qr{^/configuration$}, {
GET => {
resource => {
@@ -115,4 +126,13 @@ sub get_configuration {
return $result;
}
+sub get_empty {
+ my ($self) = @_;
+ return {
+ urlbase => $self->type('string', correct_urlbase() . "bzapi/"),
+ documentation => $self->type('string', BZAPI_DOC),
+ version => $self->type('string', BUGZILLA_VERSION)
+ };
+}
+
1;