Department API

Create a department

You can use POST method to create a department.
Request:

POST   /api/departments?departmentname=Marketing&restrictiontype=A&restrictiondepartments=Administration&blockfile=0
restrictiontype:

A : Allow D : Deny {} : No Restriction

 

restrictiondepartments:

Department to be restricted for the users in the department.

 
blockfile :

1 – Block file transfer. 0 – Allow file transfer.

restrictiontype, restrictiondepartment, blockfile are optional.
Response:

Status: 200 OK { "success":true }

 

Update a department

To update a department, you can use PUT method.
Request:

PUT     /api/departments/[department]?departmentname=Marketers&restrictiontype=A&restrictiondepartments=Administration&blockfile=0
[department] – Previous department name.

departmentname, restrictiondepartments, restrictiontype, blockfile are optional.
Response:

Status: 200 OK { "success":true }

 

Deleting a department

To Delete a department, you can use DELETE method.
Request:

DELETE    /api/departments/[department]
[department] – Departmentname.

Response:

Status: 200 OK  {  "success":true  }

 

Retrieving a department

For retrieving a department, you can use GET method.
Request:

GET      /api/departments/[department]
[department] – Departmentname.

Response:

Status: 200 OK  {  "row":{  "departmentname":"Marketer",  "restrictiontype":"A",  "restrictiondepartments":"Administration",  "blockfile":0  },  "success":true  }

 

Retrieving all departments

For retrieving all the departments, you can use GET method.
Request:

GET    /api/departments

Response:

Status: 200 OK { "row":{ "departmentname":"Marketers", "restrictiontype":"A", "restrictiondepartments":"Administration", "blockfile":0 }, { "departmentname":"Administration", "restrictiontype":"", "restrictiondepartments":"", "blockfile":0 }, "success":true }