Departments¶
Create a new department¶
-
POST
/api/departments/create
¶ - Query Parameters
name (string) – Department name
private (boolean) – 0=public department, 1=private department
Example request:
cURL
curl \ -X POST \ -H 'Token: <token>' https://demo.helpdeskz.com/api/departments/create/ \ -F 'name="Bug report"' \ -F 'private="0"'
PHP
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://demo.helpdeskz.com/api/departments/create/', CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => array('name' => 'Bug report','private' => '0'), CURLOPT_HTTPHEADER => array( 'Token: <token>' ), )); $response = curl_exec($curl); curl_close($curl);
Example response:
{ "success": 1, "department_id": 4, "message": "Department was created." }
Retrieve a list of all departments¶
-
GET
/api/departments/
¶ Example request:
cURL
curl \ -H 'Token: <token>' https://demo.helpdeskz.com/api/departments
PHP
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://demo.helpdeskz.com/api/departments', CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'Token: <token>' ), )); $response = curl_exec($curl); curl_close($curl);
Example response:
{ "success": 1, "departments": [ { "id": "1", "name": "General", "private": "0" }, { "id": "2", "name": "Advertising", "private": "0" }, { "id": "3", "name": "Sales", "private": "0" }, { "id": "4", "name": "Bug report", "private": "0" } ] }
Retrieve details of department by ID¶
-
GET
/api/departments/show/<user_id>
¶ Example request:
cURL
curl \ -H 'Token: <token>' https://demo.helpdeskz.com/api/departments/show/4
PHP
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://demo.helpdeskz.com/api/departments/show/4', CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'Token: <token>' ), )); $response = curl_exec($curl); curl_close($curl);
Example response:
{ "success": 1, "department": { "id": "4", "name": "Bug report", "private": "0" } }
Update department¶
-
POST
/api/departments/update/<department_id>
¶ - Query Parameters
name (string) – New department name
private (boolean) – 0=public department, 1=private department
Example request:
cURL
curl \ -X POST \ -H 'Token: <token>' https://demo.helpdeskz.com/api/departments/update/4 \ -F 'name="Issues report"' -F 'private="0"'
PHP
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://demo.helpdeskz.com/api/departments/update/1', CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => array('name' => 'Issues report', 'private' => '0'), CURLOPT_HTTPHEADER => array( 'Token: <token>' ), )); $response = curl_exec($curl); curl_close($curl);
Example response:
{ "success": 1, "message": "Department was updated." }
Delete department¶
-
POST
/api/departments/delete/<department_id>
¶ Example request:
cURL
curl \ -X POST \ -H 'Token: <token>' https://demo.helpdeskz.com/api/departments/delete/4
PHP
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://demo.helpdeskz.com/api/departments/delete/4', CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_HTTPHEADER => array( 'Token: <token>' ), )); $response = curl_exec($curl); curl_close($curl);
Example response:
{ "success": 1, "message": "Department and its tickets were removed." }
Note
With this action, all tickets from this department will be removed.