====================
Close Review Request
====================

:Path: ``api/json/reviewrequests/{review_request_id}/close/{type}/``


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

+-------------------+---------+-------------------------------------+
| Parameter         | Type    | Description                         |
+===================+=========+=====================================+
| review_request_id | Integer | The ID of the review request.       |
+-------------------+---------+-------------------------------------+
| type              | String  | The close type. This will be one of |
|                   |         | ``submitted`` or ``discarded``.     |
+-------------------+---------+-------------------------------------+


HTTP POST
=========

Closes a review request.

This will mark a review request as either submitted or discarded, depending
on the URL given.


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

.. code-block:: none

    POST /api/json/reviewrequests/12321/close/submitted/


Responses
---------

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

On success, no payload data beyond the ``stat`` field will be sent.


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

.. code-block:: javascript

    {
      stat: "ok"
    }


HTTP 400: Bad Request
~~~~~~~~~~~~~~~~~~~~~

Error 102: Invalid Attribute
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The ``type`` specified in the URL was not ``discarded`` or ``submitted``.


+-------------+--------+-----------------------------------------------------+
| Field       | Type   | Description                                         |
+=============+========+=====================================================+
| attribute   | String | The invalid type that was specified in the URL.     |
+-------------+--------+-----------------------------------------------------+


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

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

The client making the request is not logged in to the server.

See :ref:`authenticating` for more information.


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

The user the client is logged in as doesn't have permission to close
the review request.


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

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

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


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