Section 14 · Stage 4: Build Applications
Web Fundamentals, HTTP & REST APIs
How the web works: HTTP, JSON and the rules of good REST API design, tested with real tools.
What you will be able to do
- Explain what happens between typing a URL and seeing a page
- Read and write HTTP requests and responses: methods, headers, status codes and bodies
- Convert Java objects to and from JSON with Jackson
- Design REST endpoints with correct URLs, methods and status codes
- Test APIs with browser dev tools, curl and Postman
- Call a REST API from Java and build a tiny HTTP server without a framework
What you will learn
14.1How the Web Works8 lessons
The path a request takes from your browser to a server and back. Language-neutral: every lesson uses the browser, curl and command-line tools only.
- Clients and servers30 min
- IP addresses, ports and DNS35 min
- URLs: scheme, host, port, path and query30 min
- TCP: the connection under HTTP35 min
- HTTPS and TLS in plain words35 min
- Watching requests in browser dev tools35 min
- Practice: how the web works40 min
- Mini project: trace a web request end to end50 min
14.2HTTP Requests & Responses8 lessons
The structure of an HTTP message and what each part means. Language-neutral: examples are raw HTTP messages and curl.
- Request line, headers and body30 min
- GET, POST, PUT, PATCH and DELETE35 min
- Safe and idempotent methods30 min
- Status code families: 2xx, 3xx, 4xx and 5xx35 min
- Important headers: Content-Type, Accept, Authorization, Location35 min
- Sending requests with curl35 min
- Practice: HTTP requests and responses40 min
- Mini project: explore a public API with curl60 min
14.4JSON & Jackson9 lessons
Send structured data as JSON and convert it to and from Java objects with Jackson 3, the version Spring Boot 4 uses.
- JSON syntax: objects, arrays and types30 min
- Adding Jackson with Maven35 min
- ObjectMapper: object to JSON and back40 min
- Lists, maps and nested objects40 min
- Records, dates and money40 min
- Renaming and ignoring fields with annotations40 min
- Handling unknown or missing fields45 min
- Practice: JSON and Jackson50 min
- Mini project: ShopLite catalogue to JSON and back60 min
14.5REST API Design8 lessons
The rules that make an API easy to understand and use, ending with the ShopLite API designed on paper. Language-neutral: designs are URL tables, curl and JSON.
- Resources and nouns in URLs35 min
- Mapping CRUD to methods and status codes40 min
- Nested resources: /customers/{id}/orders35 min
- Filtering, sorting and pagination with query parameters40 min
- Consistent error response format40 min
- API versioning35 min
- Practice: REST API design50 min
- Project: design the ShopLite API on paper60 min
14.6Testing APIs with Tools8 lessons
Explore and test any API without writing code, using Postman and curl. Language-neutral.
- Postman: your first requests35 min
- Sending JSON bodies and headers40 min
- Postman collections and environments40 min
- Saving tests in a collection45 min
- curl recipes for daily use45 min
- Reading an API's documentation40 min
- Practice: testing APIs with tools50 min
- Mini project: a tested Postman collection for a public API60 min
14.7Calling APIs from Java7 lessons
Use Java's built-in HttpClient with Jackson to talk to real web services.
14.8A Tiny HTTP Server Without a Framework8 lessons
Build a small JSON API with the JDK's HttpServer, reusing the Section 13 service layer, to see the work a framework does for you.
- Starting an HttpServer and adding handlers45 min
- Routing by method and path by hand45 min
- Reading request bodies and writing JSON responses50 min
- Returning the right status codes50 min
- Wiring the service layer and handling many requests50 min
- What Spring Boot will do for you next35 min
- Practice: a tiny HTTP server50 min
- Project: ShopLite product API on HttpServer60 min
14.9Web & REST Practice5 lessons
Check your understanding with design exercises, interview questions, a public-API client and the ShopLite REST milestone.
