<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>6.1.11. Groups — Bugzilla 5.0.4 documentation</title> <link rel="stylesheet" href="../../../_static/bugzilla.css" type="text/css" /> <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../../../', VERSION: '5.0.4', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true, SOURCELINK_SUFFIX: '.txt' }; </script> <script type="text/javascript" src="../../../_static/jquery.js"></script> <script type="text/javascript" src="../../../_static/underscore.js"></script> <script type="text/javascript" src="../../../_static/doctools.js"></script> <link rel="shortcut icon" href="../../../_static/favicon.ico"/> <link rel="search" title="Search" href="../../../search.html" /> <link rel="next" title="6.1.12. Products" href="product.html" /> <link rel="prev" title="6.1.10. Flag Types" href="flagtype.html" /> </head> <body> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="product.html" title="6.1.12. Products" accesskey="N">next</a></li> <li class="right" > <a href="flagtype.html" title="6.1.10. Flag Types" accesskey="P">previous</a> |</li> <li class="nav-item nav-item-0"><a href="../../../index.html">Bugzilla 5.0.4 documentation</a> »</li> <li class="nav-item nav-item-1"><a href="../../index.html" >6. WebService API Reference</a> »</li> <li class="nav-item nav-item-2"><a href="index.html" accesskey="U">6.1. Core API v1</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body" role="main"> <div class="section" id="groups"> <h1>6.1.11. Groups<a class="headerlink" href="#groups" title="Permalink to this headline">¶</a></h1> <p>The API for creating, changing, and getting information about groups.</p> <div class="section" id="create-group"> <span id="rest-group-create"></span><h2>6.1.11.1. Create Group<a class="headerlink" href="#create-group" title="Permalink to this headline">¶</a></h2> <p>This allows you to create a new group in Bugzilla. You must be authenticated and be in the <em>creategroups</em> group to perform this action.</p> <p><strong>Request</strong></p> <div class="highlight-text"><div class="highlight"><pre><span></span>POST /rest/group </pre></div> </div> <div class="highlight-js"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="s2">"name"</span> <span class="o">:</span> <span class="s2">"secret-group"</span><span class="p">,</span> <span class="s2">"description"</span> <span class="o">:</span> <span class="s2">"Too secret for you!"</span><span class="p">,</span> <span class="s2">"is_active"</span> <span class="o">:</span> <span class="kc">true</span> <span class="p">}</span> </pre></div> </div> <p>Some params must be set, or an error will be thrown. The required params are marked in <strong>bold</strong>.</p> <table border="1" class="docutils"> <colgroup> <col width="19%" /> <col width="9%" /> <col width="71%" /> </colgroup> <thead valign="bottom"> <tr class="row-odd"><th class="head">name</th> <th class="head">type</th> <th class="head">description</th> </tr> </thead> <tbody valign="top"> <tr class="row-even"><td><strong>name</strong></td> <td>string</td> <td>A short name for this group. Must be unique. This is not usually displayed in the user interface, except in a few places.</td> </tr> <tr class="row-odd"><td><strong>description</strong></td> <td>string</td> <td>A human-readable name for this group. Should be relatively short. This is what will normally appear in the UI as the name of the group.</td> </tr> <tr class="row-even"><td>user_regexp</td> <td>string</td> <td>A regular expression. Any user whose Bugzilla username matches this regular expression will automatically be granted membership in this group.</td> </tr> <tr class="row-odd"><td>is_active</td> <td>boolean</td> <td><code class="docutils literal"><span class="pre">true</span></code> if new group can be used for bugs, <code class="docutils literal"><span class="pre">false</span></code> if this is a group that will only contain users and no bugs will be restricted to it.</td> </tr> <tr class="row-even"><td>icon_url</td> <td>string</td> <td>A URL pointing to a small icon used to identify the group. This icon will show up next to users' names in various parts of Bugzilla if they are in this group.</td> </tr> </tbody> </table> <p><strong>Response</strong></p> <div class="highlight-js"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="s2">"id"</span><span class="o">:</span> <span class="mi">22</span> <span class="p">}</span> </pre></div> </div> <table border="1" class="docutils"> <colgroup> <col width="11%" /> <col width="11%" /> <col width="79%" /> </colgroup> <thead valign="bottom"> <tr class="row-odd"><th class="head">name</th> <th class="head">type</th> <th class="head">description</th> </tr> </thead> <tbody valign="top"> <tr class="row-even"><td>id</td> <td>int</td> <td>ID of the newly-created group.</td> </tr> </tbody> </table> </div> <div class="section" id="update-group"> <span id="rest-group-update"></span><h2>6.1.11.2. Update Group<a class="headerlink" href="#update-group" title="Permalink to this headline">¶</a></h2> <p>This allows you to update a group in Bugzilla. You must be authenticated and be in the <em>creategroups</em> group to perform this action.</p> <p><strong>Request</strong></p> <p>To update a group using the group ID or name:</p> <div class="highlight-text"><div class="highlight"><pre><span></span>PUT /rest/group/(id_or_name) </pre></div> </div> <div class="highlight-js"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="s2">"name"</span> <span class="o">:</span> <span class="s2">"secret-group"</span><span class="p">,</span> <span class="s2">"description"</span> <span class="o">:</span> <span class="s2">"Too secret for you! (updated description)"</span><span class="p">,</span> <span class="s2">"is_active"</span> <span class="o">:</span> <span class="kc">false</span> <span class="p">}</span> </pre></div> </div> <p>You can edit a single group by passing the ID or name of the group in the URL. To edit more than one group, you can specify addition IDs or group names using the <code class="docutils literal"><span class="pre">ids</span></code> or <code class="docutils literal"><span class="pre">names</span></code> parameters respectively.</p> <p>One of the below must be specified.</p> <table border="1" class="docutils"> <colgroup> <col width="18%" /> <col width="6%" /> <col width="75%" /> </colgroup> <thead valign="bottom"> <tr class="row-odd"><th class="head">name</th> <th class="head">type</th> <th class="head">description</th> </tr> </thead> <tbody valign="top"> <tr class="row-even"><td><strong>id_or_name</strong></td> <td>mixed</td> <td>Integer group or name.</td> </tr> <tr class="row-odd"><td><strong>ids</strong></td> <td>array</td> <td>IDs of groups to update.</td> </tr> <tr class="row-even"><td><strong>names</strong></td> <td>array</td> <td>Names of groups to update.</td> </tr> </tbody> </table> <p>The following parameters specify the new values you want to set for the group(s) you are updating.</p> <table border="1" class="docutils"> <colgroup> <col width="14%" /> <col width="9%" /> <col width="77%" /> </colgroup> <thead valign="bottom"> <tr class="row-odd"><th class="head">name</th> <th class="head">type</th> <th class="head">description</th> </tr> </thead> <tbody valign="top"> <tr class="row-even"><td>name</td> <td>string</td> <td>A new name for the groups. If you try to set this while updating more than one group, an error will occur, as group names must be unique.</td> </tr> <tr class="row-odd"><td>description</td> <td>string</td> <td>A new description for the groups. This is what will appear in the UI as the name of the groups.</td> </tr> <tr class="row-even"><td>user_regexp</td> <td>string</td> <td>A new regular expression for email. Will automatically grant membership to these groups to anyone with an email address that matches this perl regular expression.</td> </tr> <tr class="row-odd"><td>is_active</td> <td>boolean</td> <td>Set if groups are active and eligible to be used for bugs. <code class="docutils literal"><span class="pre">true</span></code> if bugs can be restricted to this group, <code class="docutils literal"><span class="pre">false</span></code> otherwise.</td> </tr> <tr class="row-even"><td>icon_url</td> <td>string</td> <td>A URL pointing to an icon that will appear next to the name of users who are in this group.</td> </tr> </tbody> </table> <p><strong>Response</strong></p> <div class="highlight-js"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="s2">"groups"</span><span class="o">:</span> <span class="p">[</span> <span class="p">{</span> <span class="s2">"changes"</span><span class="o">:</span> <span class="p">{</span> <span class="s2">"description"</span><span class="o">:</span> <span class="p">{</span> <span class="s2">"added"</span><span class="o">:</span> <span class="s2">"Too secret for you! (updated description)"</span><span class="p">,</span> <span class="s2">"removed"</span><span class="o">:</span> <span class="s2">"Too secret for you!"</span> <span class="p">},</span> <span class="s2">"is_active"</span><span class="o">:</span> <span class="p">{</span> <span class="s2">"removed"</span><span class="o">:</span> <span class="s2">"1"</span><span class="p">,</span> <span class="s2">"added"</span><span class="o">:</span> <span class="s2">"0"</span> <span class="p">}</span> <span class="p">},</span> <span class="s2">"id"</span><span class="o">:</span> <span class="s2">"22"</span> <span class="p">}</span> <span class="p">]</span> <span class="p">}</span> </pre></div> </div> <p><code class="docutils literal"><span class="pre">groups</span></code> (array) Group change objects, each containing the following items:</p> <table border="1" class="docutils"> <colgroup> <col width="9%" /> <col width="8%" /> <col width="83%" /> </colgroup> <thead valign="bottom"> <tr class="row-odd"><th class="head">name</th> <th class="head">type</th> <th class="head">description</th> </tr> </thead> <tbody valign="top"> <tr class="row-even"><td>id</td> <td>int</td> <td>The ID of the group that was updated.</td> </tr> <tr class="row-odd"><td>changes</td> <td>object</td> <td><p class="first">The changes that were actually done on this group. The keys are the names of the fields that were changed, and the values are an object with two items:</p> <ul class="last simple"> <li>added: (string) The values that were added to this field, possibly a comma-and-space-separated list if multiple values were added.</li> <li>removed: (string) The values that were removed from this field, possibly a comma-and-space-separated list if multiple values were removed.</li> </ul> </td> </tr> </tbody> </table> </div> <div class="section" id="get-group"> <span id="rest-group-get"></span><h2>6.1.11.3. Get Group<a class="headerlink" href="#get-group" title="Permalink to this headline">¶</a></h2> <p>Returns information about Bugzilla groups.</p> <p><strong>Request</strong></p> <p>To return information about a specific group ID or name:</p> <div class="highlight-text"><div class="highlight"><pre><span></span>GET /rest/group/(id_or_name) </pre></div> </div> <p>You can also return information about more than one specific group by using the following in your query string:</p> <div class="highlight-text"><div class="highlight"><pre><span></span>GET /rest/group?ids=1&ids=2&ids=3 GET /group?names=ProductOne&names=Product2 </pre></div> </div> <p>If neither IDs nor names are passed, and you are in the creategroups or editusers group, then all groups will be retrieved. Otherwise, only groups that you have bless privileges for will be returned.</p> <table border="1" class="docutils"> <colgroup> <col width="13%" /> <col width="9%" /> <col width="78%" /> </colgroup> <thead valign="bottom"> <tr class="row-odd"><th class="head">name</th> <th class="head">type</th> <th class="head">description</th> </tr> </thead> <tbody valign="top"> <tr class="row-even"><td>id_or_name</td> <td>mixed</td> <td>Integer group ID or name.</td> </tr> <tr class="row-odd"><td>ids</td> <td>array</td> <td>Integer IDs of groups.</td> </tr> <tr class="row-even"><td>names</td> <td>array</td> <td>Names of groups.</td> </tr> <tr class="row-odd"><td>membership</td> <td>boolean</td> <td>Set to 1 then a list of members of the passed groups names and IDs will be returned.</td> </tr> </tbody> </table> <p><strong>Response</strong></p> <div class="highlight-js"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="s2">"groups"</span><span class="o">:</span> <span class="p">[</span> <span class="p">{</span> <span class="s2">"membership"</span><span class="o">:</span> <span class="p">[</span> <span class="p">{</span> <span class="s2">"real_name"</span><span class="o">:</span> <span class="s2">"Bugzilla User"</span><span class="p">,</span> <span class="s2">"can_login"</span><span class="o">:</span> <span class="kc">true</span><span class="p">,</span> <span class="s2">"name"</span><span class="o">:</span> <span class="s2">"user@bugzilla.org"</span><span class="p">,</span> <span class="s2">"login_denied_text"</span><span class="o">:</span> <span class="s2">""</span><span class="p">,</span> <span class="s2">"id"</span><span class="o">:</span> <span class="mi">85</span><span class="p">,</span> <span class="s2">"email_enabled"</span><span class="o">:</span> <span class="kc">false</span><span class="p">,</span> <span class="s2">"email"</span><span class="o">:</span> <span class="s2">"user@bugzilla.org"</span> <span class="p">},</span> <span class="p">],</span> <span class="s2">"is_active"</span><span class="o">:</span> <span class="kc">true</span><span class="p">,</span> <span class="s2">"description"</span><span class="o">:</span> <span class="s2">"Test Group"</span><span class="p">,</span> <span class="s2">"user_regexp"</span><span class="o">:</span> <span class="s2">""</span><span class="p">,</span> <span class="s2">"is_bug_group"</span><span class="o">:</span> <span class="kc">true</span><span class="p">,</span> <span class="s2">"name"</span><span class="o">:</span> <span class="s2">"TestGroup"</span><span class="p">,</span> <span class="s2">"id"</span><span class="o">:</span> <span class="mi">9</span> <span class="p">}</span> <span class="p">]</span> <span class="p">}</span> </pre></div> </div> <p>If the user is a member of the <em>creategroups</em> group they will receive information about all groups or groups matching the criteria that they passed. You have to be in the creategroups group unless you're requesting membership information.</p> <p>If the user is not a member of the <em>creategroups</em> group, but they are in the "editusers" group or have bless privileges to the groups they require membership information for, the is_active, is_bug_group and user_regexp values are not supplied.</p> <p>The return value will be an object containing group names as the keys; each value will be an object that describes the group and has the following items:</p> <table border="1" class="docutils"> <colgroup> <col width="16%" /> <col width="8%" /> <col width="77%" /> </colgroup> <thead valign="bottom"> <tr class="row-odd"><th class="head">name</th> <th class="head">type</th> <th class="head">description</th> </tr> </thead> <tbody valign="top"> <tr class="row-even"><td>id</td> <td>int</td> <td>The unique integer ID that Bugzilla uses to identify this group. Even if the name of the group changes, this ID will stay the same.</td> </tr> <tr class="row-odd"><td>name</td> <td>string</td> <td>The name of the group.</td> </tr> <tr class="row-even"><td>description</td> <td>string</td> <td>The description of the group.</td> </tr> <tr class="row-odd"><td>is_bug_group</td> <td>int</td> <td>Whether this group is to be used for bug reports or is only administrative specific.</td> </tr> <tr class="row-even"><td>user_regexp</td> <td>string</td> <td>A regular expression that allows users to be added to this group if their login matches.</td> </tr> <tr class="row-odd"><td>is_active</td> <td>int</td> <td>Whether this group is currently active or not.</td> </tr> <tr class="row-even"><td>users</td> <td>array</td> <td>User objects that are members of this group; only returned if the user sets the <code class="docutils literal"><span class="pre">membership</span></code> parameter to 1. Each user object has the items describe in the User object below.</td> </tr> </tbody> </table> <p>User object:</p> <table border="1" class="docutils"> <colgroup> <col width="17%" /> <col width="9%" /> <col width="74%" /> </colgroup> <thead valign="bottom"> <tr class="row-odd"><th class="head">name</th> <th class="head">type</th> <th class="head">description</th> </tr> </thead> <tbody valign="top"> <tr class="row-even"><td>id</td> <td>int</td> <td>The ID of the user.</td> </tr> <tr class="row-odd"><td>real_name</td> <td>string</td> <td>The actual name of the user.</td> </tr> <tr class="row-even"><td>email</td> <td>string</td> <td>The email address of the user.</td> </tr> <tr class="row-odd"><td>name</td> <td>string</td> <td>The login name of the user. Note that in some situations this is different than their email.</td> </tr> <tr class="row-even"><td>can_login</td> <td>boolean</td> <td>A boolean value to indicate if the user can login into bugzilla.</td> </tr> <tr class="row-odd"><td>email_enabled</td> <td>boolean</td> <td>A boolean value to indicate if bug-related mail will be sent to the user or not.</td> </tr> <tr class="row-even"><td>disabled_text</td> <td>string</td> <td>A text field that holds the reason for disabling a user from logging into Bugzilla. If empty, then the user account is enabled; otherwise it is disabled/closed.</td> </tr> </tbody> </table> <hr class="docutils" /> <p>This documentation undoubtedly has bugs; if you find some, please file them <a class="reference external" href="https://bugzilla.mozilla.org/enter_bug.cgi?product=Bugzilla&component=Documentation">here</a>.</p> </div> </div> </div> </div> </div> <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebarwrapper"> <p class="logo"><a href="../../../index.html"> <img class="logo" src="../../../_static/bugzilla.png" alt="Logo"/> </a></p> <h3><a href="../../../index.html">Table Of Contents</a></h3> <ul> <li><a class="reference internal" href="#">6.1.11. Groups</a><ul> <li><a class="reference internal" href="#create-group">6.1.11.1. Create Group</a></li> <li><a class="reference internal" href="#update-group">6.1.11.2. Update Group</a></li> <li><a class="reference internal" href="#get-group">6.1.11.3. Get Group</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="flagtype.html" title="previous chapter">6.1.10. Flag Types</a></p> <h4>Next topic</h4> <p class="topless"><a href="product.html" title="next chapter">6.1.12. Products</a></p> <div id="searchbox" style="display: none" role="search"> <h3>Quick search</h3> <form class="search" action="../../../search.html" method="get"> <div><input type="text" name="q" /></div> <div><input type="submit" value="Go" /></div> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="product.html" title="6.1.12. Products" >next</a></li> <li class="right" > <a href="flagtype.html" title="6.1.10. Flag Types" >previous</a> |</li> <li class="nav-item nav-item-0"><a href="../../../index.html">Bugzilla 5.0.4 documentation</a> »</li> <li class="nav-item nav-item-1"><a href="../../index.html" >6. WebService API Reference</a> »</li> <li class="nav-item nav-item-2"><a href="index.html" >6.1. Core API v1</a> »</li> </ul> </div> <div class="footer" role="contentinfo"> Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.6.6. </div> </body> </html>