- clone repo
- cd intEmp
- dotnet build
- dotnet run
- Application will be running on http://localhost:5103
Welcome to the intEmp API documentation. This API provides endpoints for employee management and authentication.
JWT Bearer Token must be provided for all requests except for creating an employee and logging in. The token should be included in the Authorization header using the Bearer scheme.
Authorization: Bearer {token}
Authenticate an employee and obtain a JWT token.
URL: /api/Auth/login
Method: POST
Request Body:
{
"email": "string",
"password": "string"
}
Response:
200 OK
- Success
Example cURL Request:
curl -X POST "https://api.example.com/api/Auth/login" \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "password123"
}'
Retrieve a list of all employees.
URL: /api/Employee
Method: GET
Response:
200 OK
- Success
Example cURL Request:
curl -X GET "https://api.example.com/api/Employee" \
-H "Authorization: Bearer {token}"
Create a new employee. No authentication is required for this endpoint.
URL: /api/Employee
Method: POST
Request Body:
{
"firstName": "string",
"lastName": "string",
"email": "string",
"phone": "string",
"department": "string",
"password": "string",
"baseSalary": 0
}
Response:
200 OK
- Success
Example cURL Request:
curl -X POST "https://api.example.com/api/Employee" \
-H "Content-Type: application/json" \
-d '{
"firstName": "John",
"lastName": "Doe",
"email": "john.doe@example.com",
"phone": "123-456-7890",
"department": "Engineering",
"password": "securepassword",
"baseSalary": 60000
}'
Retrieve an employee by their ID.
URL: /api/Employee/{id}
Method: GET
Path Parameters:
id
(required): The ID of the employee.
Response:
200 OK
- Success
Example cURL Request:
curl -X GET "https://api.example.com/api/Employee/1" \
-H "Authorization: Bearer {token}"
Update an existing employee's details.
URL: /api/Employee/{id}
Method: PUT
Path Parameters:
id
(required): The ID of the employee.
Request Body:
{
"firstName": "string",
"lastName": "string",
"email": "string",
"phone": "string",
"department": "string",
"password": "string",
"baseSalary": 0,
"bonus": 0
}
Response:
200 OK
- Success
Example cURL Request:
curl -X PUT "https://api.example.com/api/Employee/1" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{
"firstName": "John",
"lastName": "Doe",
"email": "john.doe@example.com",
"phone": "123-456-7890",
"department": "Engineering",
"password": "newpassword",
"baseSalary": 65000,
"bonus": 5000
}'
Delete an employee by their ID.
URL: /api/Employee/{id}
Method: DELETE
Path Parameters:
id
(required): The ID of the employee.
Response:
200 OK
- Success
Example cURL Request:
curl -X DELETE "https://api.example.com/api/Employee/1" \
-H "Authorization: Bearer {token}"
Export the list of employees.
URL: /api/Employee/export
Method: GET
Response:
200 OK
- Success
Example cURL Request:
curl -X GET "https://api.example.com/api/Employee/export" \
-H "Authorization: Bearer {token}"
{
"firstName": "string",
"lastName": "string",
"email": "string",
"phone": "string",
"department": "string",
"password": "string",
"baseSalary": 0
}
{
"id": 1,
"firstName": "string",
"lastName": "string",
"email": "string",
"phone": "string",
"department": "string",
"passwordHash": "string",
"createdAt": "2021-01-01T00:00:00Z",
"updatedAt": "2021-01-01T00:00:00Z",
"salary": {
"id": 1,
"employeeId": 1,
"baseSalary": 0,
"bonus": 0,
"date": "2021-01-01"
}
}
{
"email": "string",
"password": "string"
}
{
"firstName": "string",
"lastName": "string",
"email": "string",
"phone": "string",
"department": "string",
"password": "string",
"baseSalary": 0,
"bonus": 0
}
{
"id": 1,
"employeeId": 1,
"baseSalary": 0,
"bonus": 0,
"date": "2021-01-01",
"employee": {
"id": 1,
"firstName": "string",
"lastName": "string",
"email": "string",
"phone": "string",
"department": "string",
"passwordHash": "string",
"createdAt": "2021-01-01T00:00:00Z",
"updatedAt": "2021-01-01T00:00:00Z"
}
}