This is a school project (lab 1) made in the course Java Enterprise. It is a simple JAX-RS application that has one entity (student). Students can be added, deleted, updated and read.
A student has 5 attributes.
- id
- firstName
- lastName
- phoneNumber
- Clone or Fork this projekt
- Download Payara to your local machine
- Add run-configuration:
- Select payara server - local
- Choose application server (path to payara)
- Add deployment (student-manager-system:war)
- Run your Configuration
Now you can use insomnia to send requests to the application.
The URL for all endpoints starts with: http://localhost:8080/student-management-system/api/v1
- Create a student:
- URL: http://localhost:8080/student-management-system/api/v1/students
- HTTP VERB:
PUT - You have to send a student in JSON format.
- id is optional and will be generated automatically if not specified
- firstName, lastName and email are mandatory
- phoneNumber is optional
{
"firstName": "Helena",
"lastName": "Halldin",
"email": "example@example.com",
"phoneNumber": "123456789"
}- Find all students:
- URL: http://localhost:8080/student-management-system/api/v1/students
- HTTP VERB:
GET
- Find a student by id:
- URL: http://localhost:8080/student-management-system/api/v1/students/{id}
- replace {id} with the id you are looking for
- HTTP VERB:
GET
- URL: http://localhost:8080/student-management-system/api/v1/students/{id}
- Find all students with a specific last name:
- URL: http://localhost:8080/student-management-system/api/v1/students?lastname={lastname}
- replace {lastname} with the name you are looking for
- HTTP VERB:
GET
- URL: http://localhost:8080/student-management-system/api/v1/students?lastname={lastname}
- Update a student:
- URL: http://localhost:8080/student-management-system/api/v1/students/{id}
- (replace {id} with the id you are looking for)
- HTTP VERB:
PUT - Note: this is a full update where you replace all attributes.
- You have to send a student in JSON format.
- URL: http://localhost:8080/student-management-system/api/v1/students/{id}
{
"firstName": "Helena",
"lastName": "Eklund",
"email": "example@example.com"
}- Delete a student:
- URL: http://localhost:8080/student-management-system/api/v1/students/{id}
- replace {id} with the id of the student you want to delete
- HTTP VERB:
DELETE
- URL: http://localhost:8080/student-management-system/api/v1/students/{id}