Web Services
CC-P03 intermediate
Practical 3: RESTful CRUD service with JAX-RS
Complete a Jersey (JAX-RS) Student API with GET, POST, PUT and DELETE, JSON payloads, validation and correct HTTP status codes, then test every endpoint Postman-style and with curl.
What you'll do
- Map HTTP methods to resource methods with JAX-RS
- Use path parameters and JSON entities
- Return correct status codes (200, 201, 204, 400, 404)
- Test CRUD endpoints with an HTTP client and curl
Lab tasks
- 1 Implement GET by id, PUT and DELETE
- 2 Deploy the API
- 3 POST – create a student (201)
- 4 POST invalid data (400)
- 5 GET the collection (200)
- 6 GET one student by id (200)
- 7 PUT – update the student (200)
- 8 DELETE it (204) and confirm 404
- 9 Repeat a call with curl