Training APIs
Overview ¶
The Training API provides endpoints for managing training records, filtering training records, searching for employees, editing training records, and uploading training certificate files. These are RESTFull APIs that use the HTTP protocol for communication. The API is secured with a Bearer token, which must be included in the Authorization header of each request.
Bearer Token
A bearer token is a type of access token that is used for authorization in APIs. It is a cryptic string that is generated by the server in response to a login request. The client must send this token in the Authorization header when making requests to protected resources.
The “Bearer” keyword is a signal to the server that the token is a type of bearer token. Here’s an example of how to use it:
Authorization: Bearer <Your-Bearer-Token>
Replace
For example:
Authorization: Bearer 5262d64b892e8d4341000001
Error Messages
-
400 Bad Request: This error is returned when the server could not understand the request due to invalid syntax. Check your request body and parameters. -
401 Unauthorized: This error is returned when the request lacks valid authentication credentials for the target resource. Make sure your API key is correct. -
403 Forbidden: This error is returned when the server understood the request, but it refuses to authorize it. This status is often returned if you’re missing permissions to access the resource. -
404 Not Found: This error is returned when the server can’t find the requested resource. Check your endpoint and parameters. -
500 Internal Server Error: This error is returned when the server encounters an unexpected condition that prevented it from fulfilling the request.
Communication ¶
list_training ¶
list_trainingGET/api/training/list_training{?page,pageSize,selectedFields,filter,sort}
Overview:
The list_training endpoint, accessible at /api/training/list_training, is a GET request that is used to retrieve a list of training records.
Request Body and Response Description:
| Name | Data Type | Description |
|---|---|---|
| success | boolean | Indicates whether the operation was successful. |
| content | array | An array of training records. |
| id | number | The ID of the training record. |
| employeeName | string | The name of the employee. |
| trainingCurriculum | string | The training curriculum. |
| lastTrainingDate | string | The last training date. |
| trainingRenewalDate | string | The training renewal date. |
| status | string | The status of the training. |
| trainingCertificateFile | array | An array of training certificate files. |
| totalElements | number | The total number of elements. |
Example URI
- page
number(required)The page number.
- pageSize
number(required)The number of items per page.
- selectedFields
string(required)The selected fields.
- filter
string(required)The filter criteria.
- sort
string(required)The sort criteria.
Headers
Content-Type: application/json
Authorization: {TOKEN}200Headers
Content-Type: application/jsonBody
{
"success": true,
"content": [
{
"id": 110,
"employeeName": "Jane Doe",
"trainingCurriculum": "Refactor",
"lastTrainingDate": "08-26-2024",
"trainingRenewalDate": "08-26-2024",
"status": "Active",
"trainingCertificateFile": []
}
],
"totalElements": 1
}filter_training ¶
filter_trainingGET/api/training/filter/training
Overview:
The filter_training endpoint, accessible at /api/training/filter/training, is a GET request that is used to filter training records.
Request Body and Response Description:
| Name | Data Type | Description |
|---|---|---|
| success | boolean | Indicates whether the operation was successful. |
| content | array | An array of training records. |
| id | number | The ID of the training record. |
| name | string | The name of the training record. |
| totalElements | number | The total number of elements. |
Example URI
Headers
Content-Type: application/json
Authorization: {TOKEN}200Headers
Content-Type: application/jsonBody
{
"success": true,
"content": [
{
"id": 61,
"name": "Refactor"
}
],
"totalElements": 1
}search_employee ¶
search_employeeGET/api/training/search_employee{?search}
Overview:
The search_employee endpoint, accessible at /api/training/search_employee, is a GET request that is used to search for employees.
Request Body and Response Description:
| Name | Data Type | Description |
|---|---|---|
| success | boolean | Indicates whether the operation was successful. |
| list_personnels | array | An array of personnel records. |
| id | number | The ID of the personnel record. |
| Name | string | The name of the personnel. |
| Phone | string | The phone number of the personnel. |
| string | The email address of the personnel. |
Example URI
- search
string(required)The search query.
Headers
Content-Type: application/json
Authorization: {TOKEN}200Headers
Content-Type: application/jsonBody
{
"success": true,
"list_personnels": [
{
"id": 1003,
"Name": "ABC",
"Phone": "",
"Email": "abc@wastelinq.com"
},
{
"id": 943,
"Name": "Jane Doe",
"Phone": "",
"Email": "janedoe@wastelinq.com"
},
{
"id": 942,
"Name": "John Doe",
"Phone": "",
"Email": "johndoe@wastelinq.com"
},
{
"id": 897,
"Name": "Ken Doe",
"Phone": "",
"Email": "kendoe@wastelinq.com"
}
]
}edit_training ¶
edit_trainingPOST/api/training/edit_training
Overview:
The edit_training endpoint, accessible at /api/training/edit_training, is a POST request that is used to edit a training record.
Request Body and Response Description:
| Name | Data Type | Description |
|---|---|---|
| success | boolean | Indicates whether the operation was successful. |
| employeeName | string | The name of the employee. |
| employeePhone | string | The phone number of the employee. |
| employeeEmail | string | The email address of the employee. |
| trainingCurriculumn | string | The training curriculum. |
| lastTrainingDate | string | The last training date. |
| renewalDate | string | The renewal date. |
| status | string | The status of the training. |
Example URI
Headers
Content-Type: application/json
Authorization: {TOKEN}Body
{
"employeeName": "Jane Doe",
"employeePhone": "",
"employeeEmail": "janedoe@wastelinq.com",
"trainingCurriculumn": "",
"lastTrainingDate": "2024-08-26",
"renewalDate": "2024-08-26",
"status": "Active"
}200Headers
Content-Type: application/jsonBody
{
"success": true
}edit_training ¶
edit_trainingDELETE/api/training/edit_training/
Overview:
The edit_training endpoint, accessible at /api/training/edit_training/, is a DELETE request that is used to delete a training record.
Request Body and Response Description:
| Name | Data Type | Description |
|---|---|---|
| id | number | The ID of the training record. |
Example URI
Headers
Content-Type: application/json
Authorization: {TOKEN}Body
{
"id": 112
}200Headers
Content-Type: application/jsonBody
{
"success": true
}upload ¶
uploadPOST/api/training/upload
Overview:
The upload endpoint, accessible at /api/training/upload, is a POST request that is used to upload a training certificate file.
Request Body and Response Description:
| Name | Data Type | Description |
|---|---|---|
| id | number | The ID of the training record. |
| file | string | The name of the file. |
| success | boolean | Indicates whether the operation was successful. |
Example URI
Headers
Content-Type: application/json
Authorization: {TOKEN}Body
{
"id": 1,
"file": "dummy.txt"
}200Headers
Content-Type: application/jsonBody
{
"success": true
}