Employee.API.Documentation
Employee.API.Documentation
Authentication
Description: All endpoints require authentication. To access the endpoints, include the
Authorization header with a valid API key or bearer token.
Base URL
https://YOUR_DOMAIN/api/employee
Model: Employee
Endpoints
1. Create Employee
Request Body:
Send the data as form data to support file uploads, such as the employee profile image.
Example:
Form-Data:
employee_first_name: "John"
email: "john.doe@example.com"
phone: "123-456-7890"
employee_profile: (file)
...
Response:
Success (201 Created):
{
"id": 123,
"badge_id": "EMP001",
"employee_user_id": 1,
"employee_first_name": "John",
"employee_last_name": "Doe",
"employee_profile": "http://example.com/path/to/profile/image.jpg",
"email": "john.doe@example.com",
"phone": "123-456-7890",
"address": "123 Elm Street",
"country": "USA",
"state": "NY",
"city": "New York",
"zip": "10001",
"dob": "1985-06-15",
"gender": "male",
"qualification": "BSc Computer Science",
"experience": 5,
"marital_status": "single",
"children": 0,
"emergency_contact": "987-654-3210",
"emergency_contact_name": "Jane Doe",
"emergency_contact_relation": "Sister",
"is_active": true,
"additional_info": {"notes": "N/A"}
}
2. Retrieve Employee
Response:
Success (200 OK):
{
"id": 123,
"badge_id": "EMP001",
"employee_user_id": 1,
"employee_first_name": "John",
"employee_last_name": "Doe",
"employee_profile": "http://example.com/path/to/profile/image.jpg",
"email": "john.doe@example.com",
"phone": "123-456-7890",
"address": "123 Elm Street",
"country": "USA",
"state": "NY",
"city": "New York",
"zip": "10001",
"dob": "1985-06-15",
"gender": "male",
"qualification": "BSc Computer Science",
"experience": 5,
"marital_status": "single",
"children": 0,
"emergency_contact": "987-654-3210",
"emergency_contact_name": "Jane Doe",
"emergency_contact_relation": "Sister",
"is_active": true,
"additional_info": {"notes": "N/A"}
}
3. Update Employee
Request Body:
Send the data as form-data to support file uploads, such as the employee profile image.
Form-Data:
email: "john.newemail@example.com"
phone: "555-1234"
address: "456 Oak Avenue"
employee_profile: (file)
...
Response:
Success (200 OK):
{
"id": 123,
"badge_id": "EMP001",
"employee_user_id": 1,
"employee_first_name": "John",
"employee_last_name": "Doe",
"employee_profile": "http://example.com/path/to/profile/image.jpg",
"email": "john.newemail@example.com",
"phone": "555-1234",
"address": "456 Oak Avenue",
"country": "USA",
"state": "NY",
"city": "New York",
"zip": "10001",
"dob": "1985-06-15",
"gender": "male",
"qualification": "BSc Computer Science",
"experience": 5,
"marital_status": "single",
"children": 0,
"emergency_contact": "987-654-3210",
"emergency_contact_name": "Jane Doe",
"emergency_contact_relation": "Sister",
"is_active": true,
"additional_info": {"notes": "N/A"}
}
4. Delete Employee
Response:
Success (204 No Content):
No content
5. List Employees
Usage Example:
GET /employees/?gender=male&is_active=true
GET /employees/?marital_status=married
GET /employees/?city=New%20York
GET /employees/?experience__gte=5
Response:
Success (200 OK):
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 123,
"badge_id": "EMP001",
"employee_user_id": 1,
"employee_first_name": "John",
"employee_last_name": "Doe",
"employee_profile": "http://example.com/path/to/profile/image.jpg",
"email": "john.doe@example.com",
"phone": "123-456-7890",
"address": "123 Elm Street",
"country": "USA",
"state": "NY",
"city": "New York",
"zip": "10001",
"dob": "1985-06-15",
"gender": "male",
"qualification": "BSc Computer Science",
"experience": 5,
"marital_status": "single",
"children": 0,
"emergency_contact": "987-654-3210",
"emergency_contact_name": "Jane Doe",
"emergency_contact_relation": "Sister",
"is_active": true,
"additional_info": {"notes": "N/A"}
}
]
}
Error Codes:
Header:
● Description: All endpoints require authentication. To access the endpoints, include the
Authorization header with a valid API key or bearer token.
Base URL
https://YOUR_DOMAIN/api/employee
Model :
● EmployeeWorkInformation
Endpoints
Request Body:
{
"employee_id": 1,
"job_position_id": 2,
"department_id": 3,
"work_type_id": 4,
"employee_type_id": 5,
"job_role_id": 6,
"reporting_manager_id": 7,
"company_id": 8,
"tags": [1, 2, 3],
"location": "New York Office",
"email": "work.email@example.com",
"mobile": "123-456-7890",
"shift_id": 9,
"date_joining": "2023-01-15",
"contract_end_date": "2024-01-15",
"basic_salary": 60000,
"salary_hour": 30,
"additional_info": {"notes": "N/A"},
"experience": 5.0
}
Response:
Response:
{
"id": 123,
"employee_id": 1,
"job_position_id": 2,
"department_id": 3,
"work_type_id": 4,
"employee_type_id": 5,
"job_role_id": 6,
"reporting_manager_id": 7,
"company_id": 8,
"tags": [1, 2, 3],
"location": "New York Office",
"email": "work.email@example.com",
"mobile": "123-456-7890",
"shift_id": 9,
"date_joining": "2023-01-15",
"contract_end_date": "2024-01-15",
"basic_salary": 60000,
"salary_hour": 30,
"additional_info": {"notes": "N/A"},
"experience": 5.0
}
Request Body:
{
"job_position_id": 2,
"department_id": 3,
"work_type_id": 4,
"employee_type_id": 5,
"job_role_id": 6,
"reporting_manager_id": 7,
"company_id": 8,
"tags": [1, 2, 3],
"location": "New York Office",
"email": "work.email@example.com",
"mobile": "123-456-7890",
"shift_id": 9,
"date_joining": "2023-01-15",
"contract_end_date": "2024-01-15",
"basic_salary": 60000,
"salary_hour": 30,
"additional_info": {"notes": "N/A"},
"experience": 5.0
}
Response:
{
"id": 123,
"employee_id": 1,
"job_position_id": 2,
"department_id": 3,
"work_type_id": 4,
"employee_type_id": 5,
"job_role_id": 6,
"reporting_manager_id": 7,
"company_id": 8,
"tags": [1, 2, 3],
"location": "New York Office",
"email": "work.email@example.com",
"mobile": "123-456-7890",
"shift_id": 9,
"date_joining": "2023-01-15",
"contract_end_date": "2024-01-15",
"basic_salary": 60000,
"salary_hour": 30,
"additional_info": {"notes": "N/A"},
"experience": 5.0
}
Response:
No content
Error Codes
Header:
Base URL
https://YOUR_DOMAIN/api/employee
Model :
● EmployeeBankDetails
Endpoints
Request Body:
{
"employee_id": 1,
"bank_name": "ABC Bank",
"account_number": "1234567890",
"branch": "Main Branch",
"address": "123 Main St, City, Country",
"country": "Country",
"state": "State",
"city": "City",
"any_other_code1": "ABC123",
"any_other_code2": "XYZ456",
"additional_info": {"notes": "N/A"}
}
Response:
{
"id": 123,
"employee_id": 1,
"bank_name": "ABC Bank",
"account_number": "1234567890",
"branch": "Main Branch",
"address": "123 Main St, City, Country",
"country": "Country",
"state": "State",
"city": "City",
"any_other_code1": "ABC123",
"any_other_code2": "XYZ456"
"additional_info": {"notes": "N/A"}
}
Response:
{
"id": 123,
"employee_id": 1,
"bank_name": "ABC Bank",
"account_number": "1234567890",
"branch": "Main Branch",
"address": "123 Main St, City, Country",
"country": "Country",
"state": "State",
"city": "City",
"any_other_code1": "ABC123",
"any_other_code2": "XYZ456",
"additional_info": {"notes": "N/A"}
}
Request Body:
{
"bank_name": "XYZ Bank",
"account_number": "9876543210",
"branch": "Branch 2",
"address": "456 Another St, Another City, Another Country",
"country": "Another Country",
"state": "Another State",
"city": "Another City",
"any_other_code1": "XYZ123",
"any_other_code2": "ABC456",
"additional_info": {"notes": "Updated info"}
}
Response:
{
"id": 123,
"employee_id": 1,
"bank_name": "XYZ Bank",
"account_number": "9876543210",
"branch": "Branch 2",
"address": "456 Another St, Another City, Another Country",
"country": "Another Country",
"state": "Another State",
"city": "Another City",
"any_other_code1": "XYZ123",
"any_other_code2": "ABC456",
"additional_info": {"notes": "Updated info"}
}
Response:
No content
{
"count": 50,
"next": "https://YOUR_DOMAIN/api/employee/employee-bank-details/?page=2",
"previous": null,
"results": [
{
"id": 123,
"employee_id": 1,
"bank_name": "ABC Bank",
"account_number": "1234567890",
"branch": "Main Branch",
"address": "123 Main St, City, Country",
"country": "Country",
"state": "State",
"city": "City",
"any_other_code1": "ABC123",
"any_other_code2": "XYZ456",
"additional_info": {"notes": "N/A"}
},
{
"id": 124,
"employee_id": 2,
"bank_name": "XYZ Bank",
"account_number": "9876543210",
"branch": "Branch 2",
"address": "456 Another St, Another City, Another Country",
"country": "Another Country",
"state": "Another State",
"city": "Another City",
"any_other_code1": "XYZ123",
"any_other_code2": "ABC456",
"additional_info": {"notes": "Updated info"}
}
]
}
Error Codes
Base URL
https://YOUR_DOMAIN/api/employee
Model: DisciplinaryAction
Endpoints
Request Body:
Send the data as form-data to support file uploads and multiple values.
Example:
Form-Data:
employee_id: [1, 2] (as separate values or a CSV string)
action: 1
description: "Violation of company policy"
unit_in: "days"
days: 3
hours: "00:00"
start_date: "2024-08-01"
attachment: (file)
Response:
Success (201 Created):
{
"id": 123,
"employee_id": [1, 2],
"action": 1,
"description": "Violation of company policy",
"unit_in": "days",
"days": 3,
"hours": "00:00",
"start_date": "2024-08-01",
"attachment": "path/to/attachment"
}
Response:
Success (200 OK):
{
"id": 123,
"employee_id": [1, 2],
"action": 1,
"description": "Violation of company policy",
"unit_in": "days",
"days": 3,
"hours": "00:00",
"start_date": "2024-08-01",
"attachment": "path/to/attachment"
}
Request Body:
Send the data as form-data to support file uploads and multiple values.
Example:
Form-Data:
description: "Updated violation of company policy"
unit_in: "hours"
days: 0
hours: "04:00"
start_date: "2024-08-02"
attachment: (file)
Response:
Success (200 OK):
{
"id": 123,
"employee_id": [1, 2],
"action": 1,
"description": "Updated violation of company policy",
"unit_in": "hours",
"days": 0,
"hours": "04:00",
"start_date": "2024-08-02",
"attachment": "path/to/attachment"
}
Response:
Success (204 No Content):
No content
Response:
Error Codes
Header:
●
● Description: All endpoints require authentication. Include the Authorization header
with a valid API key or bearer token to access the endpoints.
Base URL
https://YOUR_DOMAIN/api/employee
Model :
● Policy
Endpoints
1. Create Policy
Request Body:
{
"title": "Work From Home Policy",
"body": "Detailed description of the work from home policy...",
"is_visible_to_all": true,
"specific_employees": [1, 2, 3],
"attachments": [1, 2]
}
Response:
{
"id": 1,
"title": "Work From Home Policy",
"body": "Detailed description of the work from home policy...",
"is_visible_to_all": true,
"specific_employees": [],
"attachments": [1, 2]
}
2. Retrieve Policy
Response:
Success (200 OK
{
"id": 1,
"title": "Work From Home Policy",
"body": "Detailed description of the work from home policy...",
"is_visible_to_all": true,
"specific_employees": [],
"attachments": [1, 2]
}
3. Update Policy
Request Body:
{
"title": "Updated Work From Home Policy",
"body": "Updated description of the work from home policy...",
"is_visible_to_all": false,
"specific_employees": [1, 2],
"attachments": [1, 3]
}
Response:
{
"id": 1,
"title": "Updated Work From Home Policy",
"body": "Updated description of the work from home policy...",
"is_visible_to_all": false,
"specific_employees": [1, 2],
"attachments": [1, 3]
}
4. Delete Policy
Response:
Not found
5. List Policies
Response:
{
"count": 10,
"next": "https://YOUR_DOMAIN/api/employee/policies/?page=2",
"previous": null,
"results": [
{
"id": 1,
"title": "Work From Home Policy",
"body": "Detailed description of the work from home policy...",
"is_visible_to_all": true,
"specific_employees": [],
"attachments": [1, 2]
},
{
"id": 2,
"title": "Leave Policy",
"body": "Detailed description of the leave policy...",
"is_visible_to_all": true,
"specific_employees": [],
"attachments": [3, 4]
}
]
}
Error Codes
Header:
●
● Description: All endpoints require authentication. Include the Authorization header
with a valid API key or bearer token to access the endpoints.
Base URL
https://YOUR_DOMAIN/api/employee
Model :
● Document
Endpoints
1. Create Document
Request Body:
{
"title": "Passport",
"employee_id": 1,
"document_request_id": 1,
"document": "base64_encoded_file",
"status": "requested",
"reject_reason": "Document expired",
"expiry_date": "2024-12-31",
"notify_before": 7,
"is_digital_asset": false
}
Response:
{
"id": 1,
"title": "Passport",
"employee_id": 1,
"document_request_id": 1,
"document": "https://YOUR_DOMAIN/media/employee/documents/passport.pdf",
"status": "requested",
"reject_reason": "Document expired",
"expiry_date": "2024-12-31",
"notify_before": 7,
"is_digital_asset": false
}
2. Retrieve Document
Response:
{
"id": 1,
"title": "Passport",
"employee_id": 1,
"document_request_id": 1,
"document": "https://YOUR_DOMAIN/media/employee/documents/passport.pdf",
"status": "requested",
"reject_reason": "Document expired",
"expiry_date": "2024-12-31",
"notify_before": 7,
"is_digital_asset": false
}
3. Update Document
Request Body:
{
"title": "Updated Passport",
"employee_id": 1,
"document_request_id": 1,
"document": "base64_encoded_file",
"status": "approved",
"reject_reason": "Document expired",
"expiry_date": "2024-12-31",
"notify_before": 7,
"is_digital_asset": true
}
Response:
{
"id": 1,
"title": "Updated Passport",
"employee_id": 1,
"document_request_id": 1,
"document":
"https://YOUR_DOMAIN/media/employee/documents/updated_passport.pdf",
"status": "approved",
"reject_reason": "Document expired",
"expiry_date": "2024-12-31",
"notify_before": 7,
"is_digital_asset": true
}
4. Delete Document
Response:
No content
5. List Documents
Response:
{
"count": 10,
"next": "https://YOUR_DOMAIN/api/employee/documents/?page=2",
"previous": null,
"results": [
{
"id": 1,
"title": "Passport",
"employee_id": 1,
"document_request_id": 1,
"document":
"https://YOUR_DOMAIN/media/employee/documents/passport.pdf",
"status": "requested",
"reject_reason": "Document expired",
"expiry_date": "2024-12-31",
"notify_before": 7,
"is_digital_asset": false
},
{
"id": 2,
"title": "Work Permit",
"employee_id": 2,
"document_request_id": 2,
"document":
"https://YOUR_DOMAIN/media/employee/documents/work_permit.pdf",
"status": "approved",
"reject_reason": null,
"expiry_date": "2025-06-30",
"notify_before": 30,
"is_digital_asset": true
}
]
}
Error Codes
Header:
Base URL
https://YOUR_DOMAIN/api/employee
Endpoint
Header:
Base URL
https://YOUR_DOMAIN/api/employee
Endpoint
Response:
Header:
Base URL
https://YOUR_DOMAIN/api/employee
Model :
● DocumentRequest
Endpoints
Response:
{
"id": 1,
"title": "Document Request Title",
"employee_id": [1, 2, 3],
"format": "PDF",
"max_size": 10485760,
"description": "Description of the document request"
}
Response:
{
"id": 1,
"title": "Document Request Title",
"employee_id": [1, 2, 3],
"format": "PDF",
"max_size": 10485760,
"description": "Description of the document request"
}
Response:
{
"id": 1,
"title": "Updated Document Request Title",
"employee_id": [1, 2, 3],
"format": "PDF",
"max_size": 10485760,
"description": "Updated description of the document request"
}
Response:
No content in response.
Usage Example:
To retrieve document requests for a specific employee:
GET /document-request/?employee_id=1
To retrieve document requests with a specific status:
GET /document-request/?status=pending
To retrieve document requests for employees with a specific first name:
GET /document-request/?employee_first_name=John
To retrieve document requests associated with employees in a specific department:
GET /document-request/?department_id=5
Response:
[
{
"id": 1,
"title": "Document Request Title",
"employee_id": [1, 2, 3],
"format": "PDF",
"max_size": 10485760,
"description": "Description of the document request"
},
...
]
Error Codes:
Header:
Authorization: Bearer {token}
Base URL
https://YOUR_DOMAIN/api/employee
Endpoints
1.Employee Selector
Response:
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"employee_first_name": "John",
"employee_last_name": "Doe",
"email": "john.doe@example.com",
"phone": "1234567890",
...
}
]
}
3. Response for a manager (including employees reporting to them):
{
"count": 3,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"employee_first_name": "John",
"employee_last_name": "Doe",
"email": "john.doe@example.com",
"phone": "1234567890",
...
},
{
"id": 2,
"employee_first_name": "Jane",
"employee_last_name": "Smith",
"email": "jane.smith@example.com",
"phone": "0987654321",
...
},
{
"id": 3,
"employee_first_name": "Emily",
"employee_last_name": "Johnson",
"email": "emily.johnson@example.com",
"phone": "5678901234",
...
}
]
}
Header:
Base URL
https://YOUR_DOMAIN/api/employee
Endpoint
1. Archive Employee
Response:
No content
{
"employee": "Employee Name",
"error": "Related model found for this employee."
}
Error Codes