STAGE 03 / LESSON 03
REST endpoints and OpenAPI
A clear API describes resources, operations and predictable responses.
THE IDEA
Understand it.
Model URLs around resources, such as /tasks and /tasks/123. Use HTTP methods and status codes consistently: for example, GET to read and POST to create, with a 201 response when creation succeeds.
OpenAPI is a machine-readable description of an HTTP API. It can describe paths, request bodies, response schemas and authentication. Evolve the contract carefully and use versioning when a breaking change requires it; documentation should match the implementation.
SEE IT IN CONTEXT
A task API contract
GET /tasks → 200 [ { id, title, status } ]
POST /tasks → 201 { id, title, status }
GET /tasks/123 → 200 { id, title, status }
GET /tasks/nope → 404 { message }The response shape and error status are part of the contract, not an afterthought.
LEARN FROM REAL WEBSITES
See it in the real world.
These simplified structures come from public sources. Company systems change, and the sources may describe only one project or an earlier design.
GitHub
Documentation checked November 2026A machine-readable API description
GitHub publishes an OpenAPI description for its REST API as well as endpoint documentation.
- GitHub REST endpoints
- OpenAPI description
- Developer tools
What to learn: An API description provides a structured contract that tools and developers can use to understand endpoints.
Read the source: GitHub OpenAPI descriptionSpotify
Documentation checked November 2026Describe Web API operations
Spotify's developer documentation points developers to an OpenAPI specification for its Web API.
- Spotify Web API
- OpenAPI specification
- Client or tool
What to learn: The specification describes public API operations; it is not a diagram of Spotify's internal services.
Read the source: Spotify API and OpenAPITRY IT YOURSELF
Practice.
How can a client know which fields POST /tasks expects?
Show one possible answer
Publish and maintain a contract, such as an OpenAPI request schema, and validate the same requirements in the server implementation.
GO DEEPER