========================================
Set Multiple Review Request Draft Fields
========================================

:Path: ``api/json/reviewrequests/{review_request_id}/draft/set/``


URL Parameters
==============

+-------------------+---------+-------------------------------------+
| Parameter         | Type    | Description                         |
+===================+=========+=====================================+
| review_request_id | Integer | The ID of the review request.       |
+-------------------+---------+-------------------------------------+


HTTP POST
=========

Sets the value of one or more fields in the review request's draft.

If a draft doesn't yet exist, this will create one.

Each form field in the POST data will be used as a field name. Unknown fields
will be ignored.

The following fields can be modified through this call:

+-------------------+---------+-------------------------------------------+
| Field             | Type    | Description                               |
+===================+=========+===========================================+
| branch            | String  | The branch the code applies to.           |
+-------------------+---------+-------------------------------------------+
| bugs_closed       | String  | Comma-separated list of bug numbers/IDs.  |
+-------------------+---------+-------------------------------------------+
| description       | String  | The review request's description.         |
+-------------------+---------+-------------------------------------------+
| summary           | String  | The review request's summary.             |
+-------------------+---------+-------------------------------------------+
| target_groups     | String  | Comma-separated list of target review     |
|                   |         | groups.                                   |
+-------------------+---------+-------------------------------------------+
| target_people     | String  | Comma-separated list of target reviewers. |
+-------------------+---------+-------------------------------------------+
| testing_done      | String  | The testing done on the review request.   |
+-------------------+---------+-------------------------------------------+

Note that unlike :ref:`set-review-request-draft-field`, the screenshot and
change description cannot yet be updated. This will change in a future
release.


Example Request
---------------

.. code-block:: none

    POST /api/json/reviewrequests/12321/draft/set/


Responses
---------

HTTP 200: Success
~~~~~~~~~~~~~~~~~

On success, the resulting payload will contain an entry for each field
name being modified, along with its value. If there was any validation
issue with a field name, an entry with the field name prepended with
``invalid_`` will be added, with the error.


Example Response
^^^^^^^^^^^^^^^^

.. code-block:: javascript

    {
      stat: "ok",
      summary: "This is the new summary",
      description: "This is the new description"
    }


HTTP 401: Unauthorized
~~~~~~~~~~~~~~~~~~~~~~

Error 103: Not Logged In
^^^^^^^^^^^^^^^^^^^^^^^^

The client making the request is not logged in.

See :ref:`authenticating` for more information.


HTTP 403: Forbidden
~~~~~~~~~~~~~~~~~~~

Error 101: Permission Denied
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The user the client is logged in as doesn't have permission to modify the
draft.


HTTP 404: Not Found
~~~~~~~~~~~~~~~~~~~

Error 100: Does Not Exist
^^^^^^^^^^^^^^^^^^^^^^^^^

The review request doesn't have an associated draft.


No Error Payload
^^^^^^^^^^^^^^^^

The review request with the given ``review_request_id`` does not exist on the
server.


.. comment: vim: ft=rst et ts=3
