BMO/REST

From MozillaWiki
< BMO
Revision as of 22:51, 30 January 2014 by Mcote (talk | contribs)
Jump to navigation Jump to search

Bugzilla's REST API

Until recently, Bugzilla supported only older technologies, namely XMLRPC and JSONRPC. The BMO team created a new REST API in the summer of 2013 to provide a modern Web interface to Bugzilla.

Prior to the native REST API, a separate proxy service called bzAPI was created that provided a REST API using data obtained through the older RPC interfaces as well as various other Bugzilla data sources, including CSV representations. This was a great interim solution, but now that we have a native API, and since the system hosting the proxy is not maintained by Mozilla IT, the bzAPI service will be decommissioned at some point. See Bugzilla:API_Comparison for the differences and between bzAPI and the native API.

To ease the transition, we are creating a native bzAPI compatibility layer (bug 880669) that will act exactly the same as bzAPI but will translate the queries to the native API layer. Thus clients who currently accesses BMO data via the proxy will just need to change the hostname to move to the built-in API. The path will be slightly different depending on which API you want to use: the native one, or the one compatible with the BzAPI proxy.

There is discussion in bug 866927 about making small changes to the current upstream API that bring it closer to the format used by the BzAPI proxy. We will create individual bugs as needed for any changes that are to be made. We also plan on versioning the different API changes so that users can still continue to use an older format rather than breaking their client code.

Documentation

The REST API is documented along with the other WebServices and Bugzilla's internal interfaces.

Examples of native REST API use

Here are few examples of using the API (without logging in, so with public data)

Get data for a single bug

https://bugzilla.mozilla.org/rest/bug/35

Get data for all the bugs in the 29 Branch

https://bugzilla.mozilla.org/rest/bug?version=29%20Branch

Get data for all the bugs assigned to a particular user

https://bugzilla.mozilla.org/rest/bug?assigned_to=lhenry@mozilla.com

Get data for all the bugs with the keyword "topcrash"

https://bugzilla.mozilla.org/rest/bug?keywords=topcrash

Get data about a particular product

https://bugzilla.mozilla.org/rest/product/firefox

Get data about products and components

https://bugzilla.mozilla.org/rest/product/core?component=DOM

Get data for a user

https://bugzilla.mozilla.org/rest/user?names=lhenry@mozilla.com