Which statement best describes the statelessness principle in REST API design?
Think about how REST APIs handle client-server communication without storing session data.
REST APIs are stateless, meaning each request is independent and contains all necessary information. The server does not store client context between requests.
Which HTTP method is the most appropriate for updating an existing resource completely in a REST API?
Consider which method replaces the entire resource at the given URI.
PUT is used to update or replace an existing resource completely. POST is usually for creating new resources, GET for retrieving, and DELETE for removing.
Which caching strategy best improves REST API scalability by reducing server load for frequently requested data?
Think about how HTTP headers help clients avoid unnecessary requests.
Client-side caching with cache-control headers and ETags allows clients to reuse responses when data hasn't changed, reducing server load and improving scalability.
What is a common tradeoff when using URI versioning (e.g., /v1/resource) in REST API design?
Consider how versioning affects server code and client flexibility.
URI versioning makes it clear which API version is used but can cause duplicated endpoints and extra maintenance effort on the server side.
A REST API server handles 10,000 requests per second on average. Each request takes 50ms of server processing time. How many concurrent requests must the server handle to sustain this throughput without queuing?
Use Little's Law: Concurrent = Throughput × Latency.
Little's Law states that the number of concurrent requests equals throughput multiplied by average processing time. 10,000 req/s × 0.05 s = 500 concurrent requests.