Rest Service Api with Spring Boot (demo)
In memory Service that handles a (very simple) recruiting process. The process requires two types of objects: job offers and applications from candidates.
Offer
- jobTitle (unique)
- startDate
- numberOfApplications
Application
- related offer
- candidate email (unique per Offer)
- resume text
- applicationStatus (APPLIED, INVITED, REJECTED, HIRED)
OPERATIONS
- Create a job offer and read a single and list all offers
- Apply for an job offer
- Read one and list all applications per offer
- Change progress / status of an application
- Track the number of applications
- Status change triggers a notification
- This is simple maven project
- Download or Clone project
- Goto project root directory
- mvn spring-boot:run
- http://localhost:8080/
Method | Endpoint URL | Description |
---|---|---|
GET | / | show All the Endpoints |
GET | /jobs | List all offers |
POST | /jobs | Add new offer |
GET | /jobs/{jobTitle} | Get Single job |
GET | /jobs/{jobTitle}/applications | List all application on offer |
POST | /jobs/{jobTitle}/applications | Apply candidate application |
GET | /jobs/{jobTitle}/applications/{candidateEmail} | Return single application on offer for candidate |
PUT | /jobs/{jobTitle}/applications/{candidateEmail}/change/{status} | Change the status of particular job |
- REST API
- java 1.8
- Spring Boot 1.5.9
- Spring 4.3.13
- maven
- Junit
- mockito
- Spring Test
- JSON (jackson)
- JAVAX Validation
For consuming service one can use firefox or chorme extension search for REST service testing
set request header
Content-Type=application/json;charset=UTF-8
GET http://localhost:8080/
Will Return all the endpoints in JSON
POST http://localhost:8080/jobs
Add new offer (use following body)
{"jobTitle":"job1"}
GET http://localhost:8080/jobs
List all offers
GET http://localhost:8080/jobs/{jobTitle}
GET http://localhost:8080/jobs/job1
Get Single job
POST http://localhost:8080/jobs/{jobTitle}/applications
POST http://localhost:8080/jobs/job1/applications
Apply candidate application (use following body)
{
"candidateEmail":"rizwan@mail.com",
"resumeText":"This is my resume"
}
GET http://localhost:8080/jobs/{jobTitle}/applications
GET http://localhost:8080/jobs/job1/applications
List all application on offer
GET http://localhost:8080/jobs/{jobTitle}/applications/{candidateEmail}
GET http://localhost:8080/jobs/job1/applications/rizwan@mail.com
Return single application on offer for candidate
PUT http://localhost:8080/jobs/{jobTitle}/applications/{candidateEmail}/change/{status}
PUT http://localhost:8080/jobs/job1/applications/rizwan@mail.com/change/INVITED
Change the status of particular job