Definition

Department API can interact with Department and its users in the Joget built-in directory manager.


NameDescription
1

Add department

Add a new department.

Name

Description
URL/department
HTTP MethodPOST
Body Parameters
ParameterDescription
idDepartment ID.
nameDepartment name.
description

Description of department.

organization
KeyDescription
idID of the organization that this department belongs to.
Sample Response
{
  "id": "apiTestDept",
  "name": "API TEST Department",
  "description": "This is a department created by API.",
  "organization": {
    "id": "ORG-001"
  }
}
2

Assign user to department

Assign a Joget user to a department.

Name

Description
URL/department/assignUser/{department}/{username}
HTTP MethodPOST
Path Parameters
ParameterDescription
departmentDepartment ID.
usernameUsername of Joget user.
Sample Response
{
  "userId": "cat",
  "startDate": null,
  "endDate": null,
  "employeeCode": "",
  "gradeId": "G-003",
  "departmentId": "apiTestDept",
  "organizationId": "ORG-001"
}
3

Delete department

Delete a department via department ID.

Name

Description
URL/department/{id}
HTTP MethodDELETE
Path Parameters
ParameterDescription
idDepartment ID.
Sample Response
{
  "date": "Wed Aug 28 01:29:38 SGT 2019",
  "code": "200",
  "message": "Successful operation"
}
4

Find department

Gets all departments from all organizations by default.

Able to filter or sort the returned results via parameters.

Name

Description
URL/department/find
HTTP MethodGET
Query String Parameters
ParameterDescription
nameFilterFilters the response via department ID.
organizationIdFilter departments that belong to an organization, via organization ID.
sort

Department data column to sort.

Must be used in conjunction with "sortDescending" parameter.

sortDescending

Sort the specified "sort" parameter value in ascending or descending order.

Expects a boolean value.

Must be used in conjunction with "sort" parameter.

startOffsetStarting position of records to start query. Expects an integer.
pageSizeNumber of results to return. Expects an integer.
Sample Response
[
  {
    "id": "D-001",
    "name": "CEO Office",
    "description": "",
    "organization": {
      "id": "ORG-001"
    }
  },
  {
    "id": "D-002",
    "name": "Human Resource and Admin",
    "description": "",
    "organization": {
      "id": "ORG-001"
    }
  },
	.....
]
5

Get department by ID

Get details of a department via department ID.

Name

Description
URL/department/{id}
HTTP MethodGET
Path Parameters
ParameterDescription
idDepartment ID.
Sample Response
{
  "id": "D-001",
  "name": "CEO Office",
  "description": "",
  "organization": {
    "id": "ORG-001"
  }
}
6

Unassign user from department

Unassign a Joget user from a department.

Name

Description
URL/department/unassignUser/{department}/{username}
HTTP MethodDELETE
Path Parameters
ParameterDescription
departmentDepartment ID.
usernameUsername of Joget user.
Sample Response
{
  "date": "Thu Dec 05 03:29:56 SGT 2019",
  "code": "200",
  "message": "Successful operation"
}
7

Update department

Update the details of a department.

Name

Description
URL/department
HTTP MethodPUT
Body Parameters
ParameterDescription
idDepartment ID.
nameDepartment name.
description

Description of department.

organization
KeyDescription
idID of the organization that this department belongs to.
Sample Response
{
  "id": "apiTestDept",
  "name": "API TEST Department",
  "description": "I update this department description via API.",
  "organization": {
    "id": "ORG-001"
  }
}




  • No labels