Bugzilla REST API
The defunctional Bugzilla:REST API described on this page was removed in August 2013 (see RT #5582). It is recommended to use Bugzilla's JSON[Where?] or XML RPC API[Where?]. |
How I installed the Bugzilla:REST API
There is an INSTALL file in the bzapi repository which you can try, but I had to make a few additional things the get everything to work. Here is what I did:
- Install packages:
apt-get install mercurial libapache2-mod-fastcgi perl -MCPAN -e "install BZ::Client" perl -MCPAN -e "install Array::Diff" perl -MCPAN -e "install Slurp" perl -MCPAN -e "install Moose" perl -MCPAN -e "install Test::More" perl -MCPAN -e "install Data::Walk" perl -MCPAN -e "install Class::MOP" perl -MCPAN -e "install Catalyst::Controller::REST" (include optional modules) perl -MCPAN -e "install Catalyst::Plugin::Log::Handler" (you may have to force install this)
On line 83 of /usr/local/share/perl/5.10.0/Catalyst/Plugin/Log/Handler.pm (or whereever that module was installed), comment out the following:
$self->handler(Log::Handler->new( # minlevel => 0, # maxlevel => 7, # %$config, ));
More packages:
perl -MCPAN -e "install Catalyst::Engine::HTTP" perl -MCPAN -e "install BZ::Client" perl -MCPAN -e "install SOAP::Lite" perl -MCPAN -e "install Catalyst::View::JSON" perl -MCPAN -e "install Text::CSV_XS" perl -MCPAN -e "install XML::Simple" perl -MCPAN -e "install Catalyst::Action" perl -MCPAN -e "install Class::C3::Adopt::NEXT" perl -MCPAN -e "install Catalyst::Action::RenderView"
- Check out the repository
- hg clone http://hg.mozilla.org/webtools/bzapi bzapi
- Apply the necessary patches
- Create a config file <bzapi_home>/bugzilla_api.conf. Make sure you edit the <URL_TO_BUGZILLA>
# Configuration file for Bugzilla HTTP API. # Edit the configuration parameters in here and then copy it to be called # "bugzilla_api.conf". # URL of Bugzilla to proxy. Must include trailing slash. # Make sure you get the protocol right; we don't currently handle the 301 # redirects Bugzilla uses to switch to HTTPS. bugzilla_url http://<URL_TO_BUGZILLA> # Version of Bugzilla (major and minor only please, e.g. "3.4") bugzilla_version 3.4.4 # Timezone in which the Bugzilla server is situated # Please use a name from this list: # http://en.wikipedia.org/wiki/List_of_zoneinfo_time_zones bugzilla_timezone America/Los_Angeles # You may change the name of the file you want to log to <Log::Handler> filename /var/log/bzapi.log fileopen 0 mode append newline 1 </Log::Handler> # Whether to log back-end XML-RPC calls made via the BZ::Client library log_xmlrpc 0 ############################################################################### # Don't change anything below this line. ############################################################################### name Bugzilla::API
- Try starting the server to make sure there are no errors. You can kill it if it starts successfully.
- perl -w <bzapi_home>/script/bugzilla_api_server.pl
- I added the following to my apache virtual host config file:
<Directory <bzapi_home> AddHandler cgi-script .cgi Options Indexes ExecCGI FollowSymLinks DirectoryIndex index.cgi AllowOverride Limit </Directory> FastCgiServer <bzapi_home>/script/bugzilla_api_fastcgi.pl -processes 3 -idle-timeout 180 Alias /bzapi <bzapi_home>/script/bugzilla_api_fastcgi.pl/