REST constraints, resources, HTTP methods, idempotency, status codes, pagination, versioning, HATEOAS and OpenAPI.
42 cards · basic cards · AI-written, checked twice. Edit anything.
- What are the six constraints of REST architecture?
Show answer
Client-Server, Statelessness, Uniform Interface, Cacheability, Layered System, Code on Demand
- Explain the Client-Server constraint of REST.
Show answer
Separates clients and servers so each can evolve independently without tight coupling
- What does the Statelessness constraint require?
Show answer
Each request must contain all information needed to process it; the server stores no client context
- Explain the Uniform Interface constraint in REST.
Show answer
Standardized communication through consistent resource identification, manipulation via HTTP methods, and self-descriptive messages
- What is the purpose of the Cacheability constraint?
Show answer
Responses must define themselves as cacheable or not-cacheable to improve performance and reduce server load
- Explain the Layered System constraint.
Show answer
Clients cannot tell if directly connected to the end server; systems organized in layers interact only with adjacent layers
- What is the Code on Demand constraint?
Show answer
Servers can optionally extend client functionality by transferring executable code (rarely used in modern APIs)
- What is a resource in REST API design?
Show answer
An entity or object identified by a unique URI that can be accessed and manipulated using HTTP methods
- How should resource URIs be structured in REST APIs?
Show answer
Use nouns instead of verbs, lowercase letters, hyphens to separate words, and hierarchical paths for relationships
- Should you use verbs or nouns in REST resource URLs?
Show answer
Nouns; HTTP methods provide the verbs so URLs should identify the resource being acted upon
- How should you represent a one-to-many relationship in a REST URL?
Show answer
Use hierarchical paths like /users/123/posts to show posts belonging to user 123
- What naming convention should REST resource URLs follow?
Show answer
Use plural nouns in lowercase with hyphens: /api/users, /api/blog-posts (not /user or /BlogPosts)
- What HTTP method retrieves a resource without modifying it?
Show answer
GET
- What HTTP method creates a new resource?
Show answer
POST
- What HTTP method replaces an entire existing resource?
Show answer
PUT