Base.module.api.documentation
Base.module.api.documentation
1. Login
Request Body:
{
"username": "admin",
"password": "admin"
}
Response:
Success (201 Created):
{
"employee": {
"id": 1,
"full_name": "Adam Luis",
"employee_profile": null
},
"access":
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwI
joxNzMzNDc1MzM1LCJpYXQiOjE3MzA4ODMzMzUsImp0aSI6ImM1ODQwM2FiOWY2ZDQzZmQ4MGJl
NmRmNDBkNzY1MGYxIiwidXNlcl9pZCI6MX0.hD8LC0CoSXIsrzI5bwIrwrxPA4ynuoDtdnXmxdA
Agz0"
}
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/base
Endpoints:
Request Body:
{
"job_position": "Quality Assurance",
"department_id": 2
}
Response:
Response:
{
"id": 1,
"job_position": "Software Engineer",
"department_id": 3
}
Request Body:
{
"job_position": "Senior Software Engineer",
"department_id": 3
}
Response:
{
"id": 1,
"job_position": "Senior Software Engineer",
"department_id": 3
}
Response:
{
"message": "Job position deleted successfully."
}
Response:
{
"count": 50,
"next": "https://YOUR_DOMAIN/api/base/job-positions/?page=2",
"previous": null,
"results": [
{
"id": 1,
"job_position": "Software Engineer",
"department_id": 3
},
{
"id": 2,
"job_position": "Project Manager",
"department_id": 1
},
{
"id": 3,
"job_position": "Business Analyst",
"department_id": 2
},
{
"id": 4,
"job_position": "UX Designer",
"department_id": 4
},
{
"id": 5,
"job_position": "Data Scientist",
"department_id": 3
}
]
}
Error Codes
Header:
Base URL
https://YOUR_DOMAIN/api/base
Endpoints
Response:
Request Body:
{
"job_position_id": 3,
"job_role": "Quality Assurance"
}
Response:
Request Body:
{3.
"job_position_id": 3,
"job_role": "Senior Developer"
}
Response:
Response:
No content
5.List Job Roles
Response:
Error Codes
Header:
Authorization: Bearer {token}
Base URL
https://YOUR_DOMAIN/api/base
Endpoints
Response:
{
"id": 1,
"work_type": "Full-time"
}
Request Body:
{
"work_type": "Contract"
}
Response:
Request Body:
{
"work_type": "Temporary"
}
Response:
Response:
Response:
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/base
Endpoints
Response:
{
"id": 1,
"name": "Rotating Type A",
"work_type1": {
"id": 1,
"work_type": "Full-time"
},
"work_type2": {
"id": 2,
"work_type": "Part-time"
}
}
Request Body:
{
"name": "Rotating Type C",
"work_type1": 1,
"work_type2": 3
}
Response:
{
"id": 3,
"name": "Rotating Type C",
"work_type1": {
"id": 1,
"work_type": "Full-time"
},
"work_type2": {
"id": 3,
"work_type": "Contract"
}
}
3.Update a Rotating Work Type
Request Body:
{
"name": "Rotating Type D",
"work_type1": 2,
"work_type2": 3
}
Response:
Response:
Success (204 No Content):
{
"message": "Rotating work type deleted successfully."
}
[
{
"id": 1,
"name": "Rotating Type A",
"work_type1": {
"id": 1,
"work_type": "Full-time"
},
"work_type2": {
"id": 2,
"work_type": "Part-time"
}
},
{
"id": 2,
"name": "Rotating Type B",
"work_type1": {
"id": 1,
"work_type": "Full-time"
},
"work_type2": {
"id": 3,
"work_type": "Contract"
}
}
]
Error Codes
Header:
Base URL
https://YOUR_DOMAIN/api/base
Endpoints
1. Create Company
Request Body:
{
"company": "Tech Innovations Inc.",
"hq": true,
"address": "123 Innovation Drive",
"country": "USA",
"state": "CA",
"city": "San Francisco",
"zip": "94105",
"icon": "path/to/icon.png",
"date_format": "YYYY-MM-DD",
"time_format": "24-hour"
}
Response:
{
"id": 1,
"company": "Tech Innovations Inc.",
"hq": true,
"address": "123 Innovation Drive",
"country": "USA",
"state": "CA",
"city": "San Francisco",
"zip": "94105",
"icon": "path/to/icon.png",
"date_format": "YYYY-MM-DD",
"time_format": "24-hour"
}
2. Retrieve Company
● Endpoint: GET /companies/{id}/
● Description: Retrieves the details of a specific company by ID.
● Parameters:
○ id (path parameter): The unique identifier of the company.
Response:
{
"id": 1,
"company": "Tech Innovations Inc.",
"hq": true,
"address": "123 Innovation Drive",
"country": "USA",
"state": "CA",
"city": "San Francisco",
"zip": "94105",
"icon": "path/to/icon.png",
"date_format": "YYYY-MM-DD",
"time_format": "24-hour"
}
3. Update Company
{
"company": "Updated Tech Innovations Inc.",
"hq": false,
"address": "456 New Innovation Drive",
"country": "USA",
"state": "CA",
"city": "San Francisco",
"zip": "94107",
"icon": "path/to/new_icon.png",
"date_format": "DD/MM/YYYY",
"time_format": "12-hour"
}
Response:
{
"id": 1,
"company": "Updated Tech Innovations Inc.",
"hq": false,
"address": "456 New Innovation Drive",
"country": "USA",
"state": "CA",
"city": "San Francisco",
"zip": "94107",
"icon": "path/to/new_icon.png",
"date_format": "DD/MM/YYYY",
"time_format": "12-hour"
}
4. Delete Company
Response:
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"company": "Tech Innovations Inc.",
"hq": true,
"address": "123 Innovation Drive",
"country": "USA",
"state": "CA",
"city": "San Francisco",
"zip": "94105",
"icon": "path/to/icon.png",
"date_format": "YYYY-MM-DD",
"time_format": "24-hour"
}
]
}
Error Codes
Header:
Base URL
https://YOUR_DOMAIN/api/base
Endpoints
1. Create Department
Request Body:
{
"department": "Human Resources"
}
Response:
2. Retrieve Department
Response:
{
"id": 1,
"department": "Human Resources"
}
3. Update Department
Request Body:
{
"department": "Updated Human Resources"
}
Response:
4. Delete Department
5. List Departments
Response:
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"department": "Human Resources"
}
]
}
Error Codes
● 400 Bad Request: Invalid input or request format.
● 401 Unauthorized: Missing or invalid authentication credentials.
● 404 Not Found: Resource not found.
● 500 Internal Server Error: An unexpected error occurred on the server.
Header:
Base URL
https://YOUR_DOMAIN/api/base
Endpoints
1. Create EmployeeShift
Request Body:
{
"employee_shift": "Morning Shift",
"full_time": "200:00",
"weekly_full_time": "40:00",
"company_id": [1, 2],
"grace_time_id": 1
}
Response:
{
"id": 1,
"employee_shift": "Morning Shift",
"full_time": "200:00",
"weekly_full_time": "40:00",
"company_id": [1, 2],
"grace_time_id": 1
}
2. Retrieve EmployeeShift
Response:
{
"id": 1,
"employee_shift": "Morning Shift",
"full_time": "200:00",
"weekly_full_time": "40:00",
"company_id": [1, 2],
"grace_time_id": 1
}
3. Update EmployeeShift
Request Body:
{
"employee_shift": "Evening Shift",
"full_time": "180:00",
"weekly_full_time": "35:00",
"company_id": [2, 3],
"grace_time_id": 2
}
Response:
{
"id": 1,
"employee_shift": "Evening Shift",
"full_time": "180:00",
"weekly_full_time": "35:00",
"company_id": [2, 3],
"grace_time_id": 2
}
4. Delete EmployeeShift
5. List EmployeeShifts
Response:
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"employee_shift": "Morning Shift",
"full_time": "200:00",
"weekly_full_time": "40:00",
"company_id": [1, 2],
"grace_time_id": 1
}
]
}
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/base
Endpoints
Request Body:
{
"employee_id": 1,
"rotating_work_type_id": 2,
"start_date": "2024-08-01",
"next_change_date": "2024-08-15",
"current_work_type": 3,
"next_work_type": 4,
"based_on": "day",
"rotate_after_day": 7,
"rotate_every_weekend": "monday",
"rotate_every": "1"
}
Response:
{
"id": 123,
"employee_id": 1,
"rotating_work_type_id": 2,
"start_date": "2024-08-01",
"next_change_date": "2024-08-15",
"current_work_type": 3,
"next_work_type": 4,
"based_on": "day",
"rotate_after_day": 7,
"rotate_every_weekend": "monday",
"rotate_every": "1",
"is_active": true
}
Response:
Request Body:
{
"rotating_work_type_id": 2,
"start_date": "2024-08-01",
"next_change_date": "2024-08-22",
"current_work_type": 3,
"next_work_type": 5,
"based_on": "week",
"rotate_after_day": 10,
"rotate_every_weekend": "sunday",
"rotate_every": "2"
}
Response:
No content
To retrieve all active rotating work type assignments for a specific employee:
GET /rotating-worktype-assings/?employee_id=1&is_active=true
GET /rotating-worktype-assings/?start_date=2024-08-01
Response:
{
"count": 5,
"next": null,
"previous": null,
"results": [
{
"id": 123,
"employee_id": 1,
"rotating_work_type_id": 2,
"start_date": "2024-08-01",
"next_change_date": "2024-08-15",
"current_work_type": 3,
"next_work_type": 4,
"based_on": "day",
"rotate_after_day": 7,
"rotate_every_weekend": "monday",
"rotate_every": "1",
"is_active": true
},
...
]
}
Error Codes
● 400 Bad Request: Invalid input or request format.
● 401 Unauthorized: Missing or invalid authentication credentials.
● 404 Not Found: Resource not found.
● 500 Internal Server Error: An unexpected error occurred on the server.
Header:
Base URL
https://YOUR_DOMAIN/api/base
Endpoints
Request Body:
{
"day": 1,
"shift_id": 2,
"minimum_working_hour": "08:15",
"start_time": "09:00",
"end_time": "17:00",
"is_night_shift": false
}
Response:
{
"id": 123,
"day": 1,
"shift_id": 2,
"minimum_working_hour": "08:15",
"start_time": "09:00",
"end_time": "17:00",
"is_night_shift": false
}
Response:
{
"id": 123,
"day": 1,
"shift_id": 2,
"minimum_working_hour": "08:15",
"start_time": "09:00",
"end_time": "17:00",
"is_night_shift": false
}
Request Body:
{
"day": 1,
"shift_id": 2,
"minimum_working_hour": "08:30",
"start_time": "08:00",
"end_time": "16:00",
"is_night_shift": true
}
Response:
{
"id": 123,
"day": 1,
"shift_id": 2,
"minimum_working_hour": "08:30",
"start_time": "08:00",
"end_time": "16:00",
"is_night_shift": true
}
Response:
Response:
{
"count": 5,
"next": null,
"previous": null,
"results": [
{
"id": 123,
"day": 1,
"shift_id": 2,
"minimum_working_hour": "08:15",
"start_time": "09:00",
"end_time": "17:00",
"is_night_shift": false
},
...
]
}
Error Codes
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/base
Endpoints
Request Body:
{
"name": "Night Shift Rotation",
"shift1": 1,
"shift2": 2
}
Response:
Success (201 Created):
{
"id": 1,
"name": "Night Shift Rotation",
"shift1": 1,
"shift2": 2
}
Response:
Success (200 OK):
{
"id": 1,
"name": "Night Shift Rotation",
"shift1": 1,
"shift2": 2
}
Request Body:
{
"name": "Day Shift Rotation",
"shift1": 2,
"shift2": 3
}
Response:
Success (200 OK):
{
"id": 1,
"name": "Day Shift Rotation",
"shift1": 2,
"shift2": 3
}
Response:
Success (204 No Content):
{
"message": "Rotating shift deleted successfully."
}
{
"count": 2,
"next": "https://YOUR_DOMAIN/api/base/rotating-shifts/?page=2",
"previous": null,
"results": [
{
"id": 1,
"name": "Night Shift Rotation",
"shift1": 1,
"shift2": 2
},
{
"id": 2,
"name": "Day Shift Rotation",
"shift1": 2,
"shift2": 3
}
]
}
Error Codes
Authentication
Required: API Key or Bearer Token
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/base
Endpoints
1. Create Rotating Shift Assign
Optional Fields:
Request Body:
{
"employee_id": 1,
"rotating_shift_id": 2,
"start_date": "2024-08-09",
"next_change_date": "2024-08-16",
"current_shift": 1,
"next_shift": 2,
"based_on": "date",
"rotate_after_day": 7,
"rotate_every_weekend": "monday",
"rotate_every": "1"
}
Response:
Success (201 Created):
{
"id": 1,
"employee_id": 1,
"rotating_shift_id": 2,
"start_date": "2024-08-09",
"next_change_date": "2024-08-16",
"current_shift": 1,
"next_shift": 2,
"based_on": "date",
"rotate_after_day": 7,
"rotate_every_weekend": "monday",
"rotate_every": "1"
}
Response:
Success (200 OK):
{
"id": 1,
"employee_id": 1,
"rotating_shift_id": 2,
"start_date": "2024-08-09",
"next_change_date": "2024-08-16",
"current_shift": 1,
"next_shift": 2,
"based_on": "date",
"rotate_after_day": 7,
"rotate_every_weekend": "monday",
"rotate_every": "1"
}
Request Body:
{
"next_change_date": "2024-08-23",
"current_shift": 2,
"next_shift": 3
}
Response:
Success (200 OK):
{
"id": 1,
"employee_id": 1,
"rotating_shift_id": 2,
"start_date": "2024-08-09",
"next_change_date": "2024-08-23",
"current_shift": 2,
"next_shift": 3,
"based_on": "date",
"rotate_after_day": 7,
"rotate_every_weekend": "monday",
"rotate_every": "1"
}
Response:
Success (204 No Content):
No content
Request:
GET /rotating-shift-assings/?employee_id=1¤t_shift=1&is_active=true
Authorization: Bearer {token}
Response:
Error Codes:
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/base
Endpoints
Required Fields:
Optional Fields:
{
"employee_id": 1,
"work_type_id": 2,
"previous_work_type_id": 1,
"requested_date": "2024-08-09",
"requested_till": "2024-09-09",
"description": "Requesting a shift change.",
"is_permanent_work_type": true,
"approved": false,
"canceled": false,
"work_type_changed": false
}
Response:
Response:
Required Fields:
At least one field must be provided to update (e.g., work_type_id, requested_date,
description).
Request Body Example:
{
"work_type_id": 3,
"description": "Requesting a temporary shift change.",
"is_permanent_work_type": false
}
Response:
{
"id": 123,
"employee_id": 1,
"work_type_id": 3,
"previous_work_type_id": 1,
"requested_date": "2024-08-09",
"requested_till": "2024-09-09",
"description": "Requesting a temporary shift change.",
"is_permanent_work_type": false,
"approved": false,
"canceled": false,
"work_type_changed": false
}
Response:
No content
Query Parameters:
Response:
Error Codes
PUT https://YOUR_DOMAIN/api/base/worktype-requests-approve/{id}/
Description
Approves an existing work type request if it hasn't already been approved and the user has the
necessary permissions.
Request Parameters
● Path Parameter:
○ id (integer) - The ID of the work type request to be approved.
Response
● Success (200 OK): The work type request was successfully approved.
Example Request
PUT https://YOUR_DOMAIN/api/base/worktype-requests-approve/1/
Authorization: Bearer {token}
Content-Type: application/json
Description
Cancels an existing work type request if it hasn't already been approved and the user has the
necessary permissions.
Request Parameters
● Path Parameter:
○ id (integer) - The ID of the work type request to be canceled.
Response
● Success (200 OK): The work type request was successfully canceled.
Example Request
PUT https://YOUR_DOMAIN/api/base/worktype-requests-cancel/1/
Authorization: Bearer {token}
Content-Type: application/json
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/base
Endpoints
Endpoint
POST /shift-requests/
Description
Creates a new shift request for an employee.
Required Fields:
Optional Fields:
{
"employee_id": 1,
"shift_id": 2,
"previous_shift_id": 1,
"requested_date": "2024-08-09",
"requested_till": "2024-09-09",
"description": "Requesting a shift change.",
"is_permanent_shift": true,
"approved": false,
"canceled": false,
"shift_changed": false,
"reallocate_to": 3,
"reallocate_approved": false,
"reallocate_canceled": false
}
Response:
{
"id": 123,
"employee_id": 1,
"shift_id": 2,
"previous_shift_id": 1,
"requested_date": "2024-08-09",
"requested_till": "2024-09-09",
"description": "Requesting a shift change.",
"is_permanent_shift": true,
"approved": false,
"canceled": false,
"shift_changed": false,
"reallocate_to": 3,
"reallocate_approved": false,
"reallocate_canceled": false
}
Endpoint
GET /shift-requests/{id}/
Description
Retrieves a specific shift request by its ID.
Response:
{
"id": 123,
"employee_id": 1,
"shift_id": 2,
"previous_shift_id": 1,
"requested_date": "2024-08-09",
"requested_till": "2024-09-09",
"description": "Requesting a shift change.",
"is_permanent_shift": true,
"approved": false,
"canceled": false,
"shift_changed": false,
"reallocate_to": 3,
"reallocate_approved": false,
"reallocate_canceled": false
}
Endpoint
PUT /shift-requests/{id}/
Description
Updates the details of a specific shift request.
Required Fields:
At least one field must be provided to update (e.g., shift_id, requested_date,
description).
{
"shift_id": 3,
"description": "Requesting a temporary shift change.",
"is_permanent_shift": false
}
Response:
{
"id": 123,
"employee_id": 1,
"shift_id": 3,
"previous_shift_id": 1,
"requested_date": "2024-08-09",
"requested_till": "2024-09-09",
"description": "Requesting a temporary shift change.",
"is_permanent_shift": false,
"approved": false,
"canceled": false,
"shift_changed": false,
"reallocate_to": 3,
"reallocate_approved": false,
"reallocate_canceled": false
}
Endpoint
DELETE /shift-requests/{id}/
Description
Deletes a specific shift request by its ID.
Response:
No content.
Endpoint
GET /shift-requests/
Description
Retrieves a list of all shift requests.
Query Parameters:
Response:
{
"count": 50,
"next": "https://YOUR_DOMAIN/api/base/shift-requests/?page=2",
"previous": null,
"results": [
{
"id": 123,
"employee_id": 1,
"shift_id": 2,
"previous_shift_id": 1,
"requested_date": "2024-08-09",
"requested_till": "2024-09-09",
"description": "Requesting a shift change.",
"is_permanent_shift": true,
"approved": false,
"canceled": false,
"shift_changed": false,
"reallocate_to": 3,
"reallocate_approved": false,
"reallocate_canceled": false
},
{
"id": 124,
"employee_id": 2,
"shift_id": 3,
"previous_shift_id": 2,
"requested_date": "2024-08-10",
"requested_till": "2024-09-10",
"description": "Requesting a temporary shift change.",
"is_permanent_shift": false,
"approved": true,
"canceled": false,
"shift_changed": true,
"reallocate_to": 4,
"reallocate_approved": true,
"reallocate_canceled": false
}
]
}
Error Codes
Header:
Description
This endpoint approves a shift request for an employee. Only users with the necessary
permissions or those who are the reporting manager can approve the request.
Base URL
https://YOUR_DOMAIN/api/base
Endpoint
PUT /shift-request-approve/{pk}/
Path Parameters
{
"status": "success"
}
Header:
Description
This endpoint cancels a shift request for an employee. The cancellation can only be performed
by the reporting manager, a user with the necessary permissions, or the employee themselves
(if the request hasn't been approved yet).
Base URL
https://YOUR_DOMAIN/api/base
Endpoint
POST /shift-request-cancel/{pk}/
Path Parameters
{
"status": "success"
}
Shift Request Delete API Documentation
Authentication
Header:
Description
This endpoint allows for the deletion of a specific shift request by its ID. Only shift requests that
have not been approved can be deleted.
Base URL
https://YOUR_DOMAIN/api/base
Endpoint
DELETE /shift-request-delete/{pk}/
Path Parameters
{
"status": "deleted"
}
Description
This endpoint is used to allocate a shift request to another employee. If there are no existing
requests for the same date, the shift reallocation will be approved.
Base URL
https://YOUR_DOMAIN/api/base
Endpoint
POST /shift-request-allocation/{pk}
Request Body
{
"status": "success"
}
Overview
The Disciplinary Action Type API allows administrators to manage various disciplinary actions,
such as warnings, suspensions, and dismissals, that can be assigned to employees. Each
action type can include an option to block the employee's login during periods of suspension or
dismissal.
Authentication
Base URL
https://YOUR_DOMAIN/api/base
Endpoint
Response:
Success (200 OK):
[
{
"id": 1,
"title": "Suspension",
"action_type": "suspension",
"block_option": true
},
{
"id": 2,
"title": "Warning",
"action_type": "warning",
"block_option": false
}
]
Response:
Success (200 OK):
{
"id": 1,
"title": "Suspension",
"action_type": "suspension",
"block_option": true
}
{
"title": "Dismissal",
"action_type": "dismissal",
"block_option": true
}
Response:
Success (201 Created):
{
"id": 3,
"title": "Dismissal",
"action_type": "dismissal",
"block_option": true
}
{
"title": "Severe Warning",
"action_type": "warning",
"block_option": false
}
Response:
Success (200 OK):
{
"id": 1,
"title": "Severe Warning",
"action_type": "warning",
"block_option": false
}
Response:
Success (204 No Content):
No content
Error Codes