0
0
HLDsystem_design~5 mins

REST API best practices in HLD - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does REST stand for and what is its main purpose?
REST stands for Representational State Transfer. It is a design style for building scalable web services that use standard HTTP methods to perform operations on resources.
Click to reveal answer
beginner
Why should REST APIs use nouns instead of verbs in their endpoint URLs?
REST APIs use nouns to represent resources because HTTP methods (GET, POST, PUT, DELETE) already define the action. This keeps URLs simple and consistent, like '/users' instead of '/getUsers'.
Click to reveal answer
intermediate
What HTTP status code should be returned after a successful resource creation?
The HTTP status code 201 Created should be returned after successfully creating a resource. It indicates the request was successful and a new resource was created.
Click to reveal answer
intermediate
Explain the importance of versioning in REST APIs.
Versioning helps manage changes in the API without breaking existing clients. It allows developers to introduce new features or fix bugs while supporting older versions.
Click to reveal answer
intermediate
What is the benefit of using pagination in REST API responses?
Pagination limits the amount of data returned in a single response, improving performance and reducing bandwidth. It helps clients handle large datasets efficiently.
Click to reveal answer
Which HTTP method is typically used to update an existing resource in a REST API?
AGET
BDELETE
CPOST
DPUT
What should a REST API return when a requested resource is not found?
A404 Not Found
B403 Forbidden
C500 Internal Server Error
D200 OK
Which of the following is a good practice for REST API URL design?
A/updateUser
B/getUserDetails
C/users/123
D/deleteUser
Why is it important to use consistent HTTP status codes in REST APIs?
ATo make debugging harder
BTo clearly communicate the result of a request
CTo confuse clients
DTo avoid using HTTP methods
What is the main reason to include versioning in REST API endpoints?
ATo support multiple API versions without breaking clients
BTo slow down the API
CTo make URLs longer
DTo hide the API structure
Describe the key principles of REST API design and why they matter.
Think about how REST uses web standards to keep APIs simple and reliable.
You got /5 concepts.
    Explain how to handle errors in a REST API and why proper error handling is important.
    Consider how clients react when something goes wrong.
    You got /4 concepts.