From 741b17a136754d0808de08154ca923459f87e2e3 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Thu, 10 Jul 2014 16:21:02 +0000 Subject: Bug 1036225: Return a link to the REST documentation in "method not found" errors --- Bugzilla/Constants.pm | 5 +++++ Bugzilla/WebService/Server/REST.pm | 1 + 2 files changed, 6 insertions(+) diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm index ce5a06286..a37638705 100644 --- a/Bugzilla/Constants.pm +++ b/Bugzilla/Constants.pm @@ -39,6 +39,7 @@ use Memoize; @Bugzilla::Constants::EXPORT = qw( BUGZILLA_VERSION + REST_DOC REMOTE_FILE LOCAL_FILE @@ -214,6 +215,10 @@ use Memoize; # Bugzilla version use constant BUGZILLA_VERSION => "4.2.9+"; +# A base link to the current REST Documentation. We place it here +# as it will need to be updated to whatever the current release is. +use constant REST_DOC => "http://www.bugzilla.org/docs/tip/en/html/api/"; + # Location of the remote and local XML files to track new releases. use constant REMOTE_FILE => 'http://updates.bugzilla.org/bugzilla-update.xml'; use constant LOCAL_FILE => 'bugzilla-update.xml'; # Relative to datadir. diff --git a/Bugzilla/WebService/Server/REST.pm b/Bugzilla/WebService/Server/REST.pm index 1be457c8f..69f97ef08 100644 --- a/Bugzilla/WebService/Server/REST.pm +++ b/Bugzilla/WebService/Server/REST.pm @@ -129,6 +129,7 @@ sub response { if (exists $json_data->{error}) { $result = $json_data->{error}; $result->{error} = $self->type('boolean', 1); + $result->{documentation} = REST_DOC; delete $result->{'name'}; # Remove JSONRPCError } elsif (exists $json_data->{result}) { -- cgit v1.2.3-24-g4f1b