WorksheetsUnderstanding REST APIs and HTTP Methods
Total questions: 10
Worksheet time: 5mins
What is the primary purpose of the GET method in HTTP?
To send data to a server.
To request data from a server.
To update data on a server.
To delete data from a server.
How does the POST method differ from the GET method?
POST method is faster than GET method
POST method can be cached while GET cannot
The POST method differs from the GET method in that POST sends data in the request body, while GET appends data to the URL.
GET method is used for sending large amounts of data
What are the three main categories of HTTP status codes?
2xx, 4xx, 5xx
1xx, 2xx, 3xx
0xx, 1xx, 2xx
4xx, 5xx, 6xx
What status code indicates a successful request?
200
301
404
500
What is a common status code for a resource not found?
200
403
500
404
What is a key principle of RESTful API design?
Stateless communication
Stateful communication
Synchronous processing
Resource-oriented architecture
How should an API handle errors to provide useful feedback?
Return generic error messages without details
Return standardized error responses with status codes, clear messages, and optional details.
Ignore errors and continue processing
Log errors without user feedback
What are some common authentication methods used in APIs?
API keys, OAuth, Basic Authentication, JWT
Password Hashing
Multi-Factor Authentication
Session Tokens
Why is versioning important in REST APIs?
Versioning has no impact on client applications.
Versioning is only necessary for public APIs.
Versioning complicates the API design process.
Versioning ensures backward compatibility and smooth transitions for clients when changes are made to the API.
What is a common approach to versioning REST APIs?
Include the version number in the request header
Include the version number in the URL path
Use a query parameter for versioning
Change the API endpoint every year
