RESTFUL API developed using Spring Boot and TDD
- Create Department
POST https://localhost:8090/departments
Payload
{
"name" : "string"
}
Response
{
"statusCode": 201,
"success": true,
"message": "Department created successfully",
"data": {
"id": 1,
"name": "string",
"status": "ACTIVE"
}
}
- Retrieve Department
GET https://localhost:8090/departments/{departmentId}
Parameter | Type | Description |
---|---|---|
departmentId |
long |
Required. The department id |
Response
{
"statusCode": 200,
"success": true,
"message": "Department retrieved successfully",
"data": {
"id": 1,
"name": "string",
"status": "ACTIVE"
}
}
- Get all Departments
GET https://localhost:8090/departments
Response
{
"statusCode": 200,
"success": true,
"message": "Departments retrieved successfully",
"data": [
{
"id": 1,
"name": "string",
"status": "ACTIVE"
}
]
}
- Update Department
UPDATE https://localhost:8090/departments/{departmentId}
Parameter | Type | Description |
---|---|---|
departmentId |
long |
Required. The department id |
Payload
{
"name" : "string"
}
Response
{
"statusCode": 200,
"success": true,
"message": "Department updated successfully",
"data": {
"id": 1,
"name": "string",
"status": "ACTIVE"
}
}
- Delete Department
DELETE https://localhost:8090/departments/{departmentId}
Parameter | Type | Description |
---|---|---|
departmentId |
long |
Required. The department id |
Response
{
"statusCode": 200,
"success": true,
"message": "Department deleted successfully",
"data": {
"id": 1,
"name": "string",
"status": "DELETED"
}
}
- Create Employees
POST https://localhost:8090/employees
Payload
{
"firstName":"string",
"lastName":"string",
"employeeNumber":"string",
"nationalID":"string",
"department":{
"id": 1
}
}
Response
{
"statusCode": 201,
"success": true,
"message": "Employee created successfully",
"data": {
"id": 1,
"firstName": "string",
"lastName": "string",
"employeeNumber": "string",
"nationalID": "string",
"department": {
"id": 1,
"name": "string",
"status": "ACTIVE"
},
"status": "ACTIVE"
}
}