Which HTTP method is the most appropriate to update a resource partially in a REST API?
Think about the method that allows partial updates without replacing the entire resource.
PATCH is used for partial updates to a resource, while PUT replaces the entire resource.
What is the main advantage of designing a REST API to be stateless?
Consider how statelessness affects scalability and server load.
Statelessness means each request contains all information needed, allowing servers to handle requests independently and scale easily.
Which strategy best helps a REST API handle sudden spikes in traffic without degrading performance?
Think about controlling request volume and reducing repeated work.
Rate limiting prevents overload by limiting requests per client, and caching reduces repeated processing, improving performance during spikes.
What is a key tradeoff when choosing JSON over XML as the data format for a REST API?
Consider features related to data validation and complexity.
XML supports namespaces and schema validation, which JSON lacks, but JSON is simpler and lighter for most REST APIs.
You expect 10,000 requests per minute to your REST API. Each request takes 100ms of server processing time. How many concurrent server threads are needed to handle the load without queuing?
Calculate how many requests happen per second and how many can be processed simultaneously.
10,000 requests/min = ~167 requests/sec. Each takes 0.1s, so concurrent threads = 167 * 0.1 = ~17.