Changes

Jump to: navigation, search

Bugzilla:BzAPI

195 bytes added, 12:48, 27 September 2010
no edit summary
If the Accept: header of a request is set to text/html (as it is by an ordinary web browser) then the API will return YAML-HTML, which the browser can display. In other words, you can play with the API using just your browser and see results in a human-readable form. [https://api-dev.bugzilla.mozilla.org/latest/bug/35 Here is an example]. This is a good way to try out the various GET calls, even if you can't use it for POST or PUT. For that, the [https://addons.mozilla.org/en-US/firefox/addon/9780 Firefox "RESTClient" addon] is very useful.
 
== Data Formats ==
 
Aside from the above-mentioned "browsing" facility, the REST API only supports [http://www.json.org/ JSON] input, and either JSON and [http://en.wikipedia.org/wiki/JSON#JSONP JSONP] output. So objects sent and received must be in JSON format.
 
'''On every request, you must set both the "Accept" and "Content-Type" HTTP headers to the MIME type of the data format you are using to communicate with the API.''' Content-Type tells the API how to interpret your request, and Accept tells it how you want your data back. "Content-Type" must be "application/json". "Accept" can be either that, or "application/javascript" for JSONP - add a "callback" parameter to name your callback.
== Authentication ==
====Cookie Auth====
 
If you have access to some existing Bugzilla login cookies for the user, you can also authenticate using that. You pass the data as URL parameters rather than as Cookie headers to prevent cross-site request forgery (XSRF).
* If one of your field names is "_all" (note underscore), you select all available fields, regardless of whether you specify any others as well
* After that, if you have specified exclude_fields, they are removed before the data is returned.
 
== Data Formats ==
 
'''On every request, you must set both the "Accept" and "Content-Type" HTTP headers to the MIME type of the data format you are using to communicate with the API.''' Content-Type tells the API how to interpret your request, and Accept tells it how you want your data back.
 
Currently, the API only supports JSON (MIME type: "application/json") and JSONP (MIME type: "application/javascript" - add a "callback" parameter to name your callback). There are no plans for this to change.
== Errors ==
Accountapprovers, antispam, confirm, emeritus
4,925
edits

Navigation menu