Bugzilla REST API wrapper
Although Travis tests are now working, test coverage is far from complete. Please report issues especially if you find problems running bz.js in the browser. Worst case scenario, please revert to 0.3 as it still basically works.
npm install bz
and use with
var bz = require("bz")
For the browser, download the lastest bz-.js from the root directory.
gulp- this will build node and browser files from the ./src directory. The node main entry now points to
Some tests are included. If you want to run the browser tests you need to copy the file
config-test.json-sample in the test/browser/files directory to a file called
config-test.json in the same directory, then fill in the placeholders with your bugzilla credentials.
var bugzilla = bzcreateClient;bugzillagetBug678223if !erroralertbugsummary;;
creates a new Bugzilla API client, optionally takes options like the REST API url, username + password, and timeout in milliseconds:
var bugzilla = bzcreateClienturl: ""username: 'email@example.com'password: 'secret'timeout: 30000;
Each method takes a callback that takes an error message (if any kind of error occurs) as its first argument, and the expected return data as its second.
retrieves a bug given a bug id.
searches with given search parameters and gets a integer count of bugs matching that query. this is not supported currently.
creates a bug and returns the id of the newly created bug.
updateBug(id, bug, callback)
updates a bug with new bug info.
retrieves the comments for a bug.
addComment(id, comment, callback)
adds a comment to a bug.
retrieves array of changes for a bug.
retrieves array of flags for a bug.
retrieves array of attachments for a bug.
createAttachment(bugId, attachment, callback)
creates an attachment on a bug, and returns the id of the newly created attachment.
gets an attachment given an attachment id.
updateAttachment(attachId, attachment, callback)
updates the attachment.
searches for users by string, matching against users' names or real names.
retrieves a user given a user id.
retrieves a list of suggested reviewers for a bug.
gets the configuration of this Bugzilla server. Note: this only works currently against Mozilla's production instance, the bugzilla 5.0 instance running on landfill has no equivalent call that can be run from the browser due to a lack of CORS headers.