Skip to main content

Get Department by ID API

Overview

Retrieves full details of a department including company info and assigned users.

  • Endpoint: /api/departments/get-by-id
  • Method: POST
  • Access: Corporate Admin / Manager

Request Body Schema

FieldTypeRequiredDescription
idString (UUID)YesTarget department ID

Request Body Example

{
"id": "d1234567-89ab-cdef-0123-456789abcdef"
}

Success Response (200 OK)

{
"success": true,
"message": "Department details retrieved successfully",
"data": {
"id": "d1234567-89ab-cdef-0123-456789abcdef",
"name": "Marketing",
"budget": "500000.00",
"costCode": "MKT-01",
"company": {
"id": "c478a846-993d-4c8d-bf8d-d77cb3370e01",
"name": "Abbott Healthcare"
},
"users": [
{
"id": "u1-uuid",
"firstName": "Vikram",
"lastName": "Singh",
"email": "vikram.singh@abbott.com"
}
],
"_count": {
"users": 1
}
}
}

Database Impact

  • Tables: departments, companies, users
  • Operations: SELECT with relational includes.