Some improvements on category, more API documentation

merge-requests/3/head
Mike Koch 9 years ago
parent 4d75b39766
commit 16d365bcad

@ -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.<br>`false` otherwise
* @apiSuccess {Integer} type `0` - Public<br>`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']);

@ -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;
}

@ -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;

@ -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",

Loading…
Cancel
Save