diff --git a/api/category/index.php b/api/category/index.php index a3f498ef..1d32a1d7 100644 --- a/api/category/index.php +++ b/api/category/index.php @@ -13,6 +13,31 @@ hesk_dbConnect(); // Routing $request_method = $_SERVER['REQUEST_METHOD']; +/** + * @api {get} /category Retrieve a ticket category + * + * @apiParam {Number} [id] The ID of the category. Omit for all categories. + * + * @apiSuccess {Number} id ID of the category + * @apiSuccess {String} name The name of the category + * @apiSuccess {Integer} cat_order The order of the category (in multiples of 10) + * @apiSuccess {Boolean} autoassign `true` if tickets set to this category are automatically assigned.
`false` otherwise + * @apiSuccess {Integer} type `0` - Public
`1` - Private + * @apiSuccess {Integer} priority Default priority of tickets created in this category + * @apiSuccess {Integer} manager User ID of the category manager, or `null` if there is no manager. + * + * @apiSuccessExample {json} Success-Response: + * HTTP/1.1 200 OK + * { + * "id": 1, + * "name": "General", + * "cat_order": 10, + * "autoassign": true, + * "type": 0, + * "priority": 2, + * "manager": 0 + * } + */ if ($request_method == 'GET') { if (isset($_GET['id'])) { $results = get_category($hesk_settings, $_GET['id']); diff --git a/api/dao/category_dao.php b/api/dao/category_dao.php index 895b141c..60441e0d 100644 --- a/api/dao/category_dao.php +++ b/api/dao/category_dao.php @@ -16,10 +16,10 @@ function get_category($hesk_settings, $id = NULL) { while ($row = hesk_dbFetchAssoc($response)) { $row['id'] = intval($row['id']); $row['cat_order'] = intval($row['cat_order']); - $row['autoassign'] = intval($row['autoassign']); + $row['autoassign'] = $row['autoassign'] == 1; $row['type'] = intval($row['type']); $row['priority'] = intval($row['priority']); - $row['manager'] = intval($row['manager']); + $row['manager'] = intval($row['manager']) == 0 ? NULL : intval($row['manager']); $results[] = $row; } diff --git a/api/priority/index.php b/api/priority/index.php index 428f8b8b..2421f5f3 100644 --- a/api/priority/index.php +++ b/api/priority/index.php @@ -7,6 +7,21 @@ require_once(API_PATH . 'core/output.php'); // Routing $request_method = $_SERVER['REQUEST_METHOD']; +/** + * @api {get} /priority Retrieve a ticket priority + * + * @apiParam {Number} [id] The ID of the priority. Omit for all priorities. + * + * @apiSuccess {Number} id ID of the priority + * @apiSuccess {String} key The language file key of the priority + * + * @apiSuccessExample {json} Success-Response: + * HTTP/1.1 200 OK + * { + * "id": 0, + * "key": "critical" + * } + */ if ($request_method == 'GET') { $results = []; $critical['id'] = 0; diff --git a/api/status/index.php b/api/status/index.php index c76a3681..98e2a39c 100644 --- a/api/status/index.php +++ b/api/status/index.php @@ -14,9 +14,9 @@ hesk_dbConnect(); $request_method = $_SERVER['REQUEST_METHOD']; /** - * @api {get} /status Retrieve a status + * @api {get} /status Retrieve a ticket status * - * @apiParam {Number} [id] The ID of the status + * @apiParam {Number} [id] The ID of the status. Omit for all statuses. * * @apiSuccess {Number} id ID of the status * @apiSuccess {String} textColor The text color used for the status on the web interface @@ -40,6 +40,7 @@ $request_method = $_SERVER['REQUEST_METHOD']; * @apiSuccess {String} keys.text The translated string of the status * * @apiSuccessExample {json} Success-Response: + * HTTP/1.1 200 OK * { * "id": 0, * "textColor": "#FF0000",