Balrog/Admin API: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
(Redirected page to Balrog)
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Balrog's Admin app provides an API that allows for retrieval and modification of Rules, Releases, and Permissions. This page documents all of the available endpoints, their parameters, and responses.
#REDIRECT [[Balrog]]
 
POST and PUT requests may submit parameters as multipart form data or json.
 
= Rules =
== /rules ==
=== GET ===
Returns all of the Rules in Balrog's database inside of a JSON Object in the following format:
<pre>
{
  "count": 2,
  "rules": [
    {
      "rule_id": 1,
      ...
    },
    {
      "rule_id": 2,
      ...
    }
  ]
}
</pre>
 
=== POST ===
Creates a new rule with the provided values. The following parameters are supported:
* priority (required)
* backgroundRate (required)
* mapping
* alias
* product
* version
* buildID
* channel
* locale
* distribution
* buildTarget
* osVersion
* distVersion
* whitelist
* comment
* headerArchitecture
 
For detailed information on parameters see [[https://wiki.mozilla.org/Balrog#Rules | the Rule table documentation]].
 
== /rules/<id_or_alias> ==
=== GET ===
Returns the entire rule identified by the id or alias given in JSON format. Eg:
<pre>
{
  "rule_id": 3,
  "product": "Firefox",
  ...
}
</pre>
 
=== POST ===
Modifies the rule identified by the id or alias given according to the parameters given. The following parameters are supported:
* data_version (required)
* priority
* backgroundRate
* mapping
* alias
* product
* version
* buildID
* channel
* locale
* distribution
* buildTarget
* osVersion
* distVersion
* whitelist
* comment
* headerArchitecture
 
=== DELETE ===
Deletes the rule identified by the id or alias given. The following parameters are supported:
* data_version (required)
 
== /rules/<id_or_alias>/revisions ==
=== GET ===
Returns previous versions of the rule identified by the id or alias given in a JSON Object in the following format:
<pre>
{
  "count": 2,
  "rules": [
    {
      "id": 1,
      "change_id": 4,
      "timestamp": 1451610061000,
      "changed_by": "jane",
      "product": "Firefox",
      ...
    },
    {
      "id": 1,
      "change_id": 4,
      "timestamp": 1451610061000,
      "changed_by": "jane",
      "product": "Firefox",
      ...
    }
  ]
</pre>
 
=== POST ===
Reverts the rule identified by the given id (alias is not supported here) to the version identified by the change_id given in the request body. The request body <em>must</em> be a JSON object containing a "change_id" key.
 
== /rules/columns/<column> ==
=== GET ===
Returns a JSON Object containing the unique values for the given column. For example, /rules/columns/product would return something like:
<pre>
{
  "count": ​10,
  "product": [
    "Firefox",
    "Graphene",
    "Thunderbird",
    "MetroFirefox",
    "Horizon",
    "B2G",
    "GMP",
    "Fennec",
    "SystemAddons",
    "B2GDroid"
  ]
}
</pre>
 
== /releases ==
=== GET ===
Returns a JSON Object containing metadata about Releases in Balrog's database. Due to its size, the actual Release "blob" is never returned from this endpoint. There are a few query arguments that affect its response.
 
If no arguments are provided, it returns information about all of the Releases in the database in the following format:
<pre>
{
  "releases": [
    {
      "name": "Firefox-34.0-build1",
      "product": "Firefox",
      "data_version": 4,
      "read_only": null
    },
    {
      "name": "Fennec-34.0-build1",
      "product": "Fennec",
      "data_version": 43,
      "read_only": true
    },
    ...
  ]
}
</pre>
 
If "product" is passed, only Releases with the given product name will be returned.
 
If "name_prefix" is passed, only Releases whose name starts with the given prefix will be returned.
 
If "names_only" is set to true, the response changes format and provides a list of all of the Release names in the database:
<pre>
{
  "names": [
    "Firefox-34.0-build1",
    "Fennec-34.0-build1",
    ...
  ]
}
</pre>
 
=== POST ===
Creates a new Release with the provided values. The following parameters are supported:
* name (required)
* product (required)
* blob (required)
 
== /releases/<release> ==
=== GET ===
Returns the "data" portion of the named Release, which is a JSON Object. If "pretty" is present in the query string and set to true, it will be pretty formatted. For example:
<pre>
{
  "name": "Firefox-mozilla-central-nightly-latest",
  "schema_version": 4,
  "platforms": {
    "WINNT_x86-msvc": {
      ...
    }
  }
}
</pre>
 
=== PUT ===
Overwrites the named Release with the data given. The "blob" field is completely overridden with the new one, <em>not</em> updated. If the Release does not exist, it is created. The following parameters are supported:
* name (required)
* product (required)
* blob (required)
* data_version (required if the Release already exists)
 
=== POST ===
Updates the named Release with the data given. The "blob" field is updated with the new one instead of being completely overriden. If the Release does not exist, it is created. The following parameters are supported:
* product (required)
* data (required)
* data_version (required if the Release already exists)
* hashFunction
* schema_version
* copyTo
* alias
 
=== DELETE ===
Deletes the named Release. The following parameters are supported:
* data_version (required)

Latest revision as of 22:44, 24 November 2016

Redirect to: