Departments API
Manage departments and organizational structure through the CitoHR API.
Get Departments
Retrieve all departments and team members in your organization.
GET /api/departments Returns:
- List of departments with head count and manager information
- List of all team members with their positions and departments
Authorization: Requires valid session.
Admin: Get Departments
Retrieve departments with pagination and filtering. Requires ADMIN role.
GET /api/admin/departments Query parameters:
page- Page number (default: 1)limit- Items per page (default: 10)sortBy- Sort field (default: name)sortOrder- Sort order: asc or desc (default: asc)search- Search by department name (optional)
Admin: Create Department
Create a new department. Requires ADMIN role.
POST /api/admin/departments Request body:
{
"name": "Engineering",
"description": "Software development team"
} Admin: Update Department
Update an existing department. Requires ADMIN role.
PUT /api/admin/departments/{id} Admin: Delete Department
Delete a department. Requires ADMIN role.
DELETE /api/admin/departments/{id} 