0% found this document useful (0 votes)
12 views

API Document Exa

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

API Document Exa

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

1.

Get all employees data

This API will be retrieving all employee’s data from the table and return information that
included name, salary, and age.

URL https://sangbui.com/api/v1/employees

Method GET

URL Params <none>

Content-Type: application/json
Header
Authorization: Basic d2ViX2FwcDpjaGFuZ2VpdA==

Data Params <none>

Success Response Code: 200 OK


Content:

“id”: “<id>”,

“employee_name”: “<name>”,

“employee_salary”: “<salary>”,

“employee_age”: “<age>”
},

“id”: “<id>”,

“employee_name”: “<name>”,

“employee_salary”: “<salary>”,

“employee_age”: “<age>”

404 Not Found (Incorrect path)


Error Response 401 Unauthorized (Incorrect permission)

Sample Call <none>

Notes <none>

2. Add new employee

This API will support for adding the new employee to the database. The employee_id
will be auto increment. Check the new submitted records at the home page. It will show
10 latest records and all value from the employee table.

URL https://sangbui.com/api/v1/employees

Method POST
URL Params <none>

Content-Type: application/json
Header
Authorization: Basic d2ViX2FwcDpjaGFuZ2VpdA==

{
“employee_name” : “<name>”,

“employee_salary”: “<salary>”,
Data Params
“employee_age”: “<age>”

Code: 200 OK
Content:

Success Response “status”: 1,

“status_message”: “Employee added successfully!”

Error Response 401 Unauthorized (Incorrect permission)

Sample Call {
“employee_name” : “An”,

“employee_salary”: “1000”,
“employee_age”: “29”

Notes Check the new submitted records ID and details at the home page.

You might also like