Back to top

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 with your actual bearer token.

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_training
GET/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

GET [Training APIs](https://test-api.wastelinq.com)./api/training/list_training?page=&pageSize=&selectedFields=&filter=&sort=
URI Parameters
HideShow
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.

Request
HideShow
Headers
Content-Type: application/json
Authorization: {TOKEN}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "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_training
GET/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

GET [Training APIs](https://test-api.wastelinq.com)./api/training/filter/training
Request
HideShow
Headers
Content-Type: application/json
Authorization: {TOKEN}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "success": true,
  "content": [
    {
      "id": 61,
      "name": "Refactor"
    }
  ],
  "totalElements": 1
}

search_employee

search_employee
GET/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.
Email string The email address of the personnel.

Example URI

GET [Training APIs](https://test-api.wastelinq.com)./api/training/search_employee?search=
URI Parameters
HideShow
search
string (required) 

The search query.

Request
HideShow
Headers
Content-Type: application/json
Authorization: {TOKEN}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "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_training
POST/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

POST [Training APIs](https://test-api.wastelinq.com)./api/training/edit_training
Request
HideShow
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"
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "success": true
}

edit_training

edit_training
DELETE/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

DELETE [Training APIs](https://test-api.wastelinq.com)./api/training/edit_training/
Request
HideShow
Headers
Content-Type: application/json
Authorization: {TOKEN}
Body
{
  "id": 112
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "success": true
}

upload

upload
POST/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

POST [Training APIs](https://test-api.wastelinq.com)./api/training/upload
Request
HideShow
Headers
Content-Type: application/json
Authorization: {TOKEN}
Body
{
  "id": 1,
  "file": "dummy.txt"
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "success": true
}

Generated by aglio on 29 Aug 2024