Test your understanding of HTTP and REST fundamentals with questions on status codes, pagination, and idempotency for safe retries. Perfect for beginners looking to strengthen their web protocols knowledge and REST API best practices.
HTTP Status Code for Success
Which HTTP status code indicates a successful GET request that returned data?
- 500 InternlError
- 301 MovedPermanant
- 200 OK
- 404 NotFound
REST Pagination Purpose
Why is pagination used in REST APIs when requesting large datasets?
- To split results into smaller, manageable pages
- To encrypt the data in transit
- To increase server processing time
- To prevent API endpoints from being accessed
Common Pagination Parameters
When implementing pagination in a REST API, which parameters are most commonly used to control page size and navigation?
- token and id
- sort and find
- user and password
- page and limit
Idempotency Concept
What does it mean for an HTTP method to be idempotent in the context of REST APIs?
- The request cannot be retried
- Every request creates a new resource
- Repeated identical requests produce the same effect
- The request is always encrypted
Safe Retry Scenario
Which HTTP method is designed to be safe and idempotent, making it suitable for retries without unintended effects?
- POST
- GET
- CONNECT
- TRACE
Client Error Status Code
If a client requests a resource that does not exist, which HTTP status code will the server typically return?
- 200 OK
- 404 NotFound
- 201 Created
- 302 Found
POST Request Idempotency
Is an HTTP POST request considered idempotent in REST API design?
- Only if the client has a static IP
- Yes, it always produces the same effect
- No, multiple identical POST requests may create multiple resources
- Only if authentication is present
HTTP Status for Resource Created
Which HTTP status code indicates that a resource has been successfully created via a REST API?
- 204 NoContnt
- 409 Conflct
- 201 Created
- 400 BadReqest
PUT Method Characteristics
What is true about the HTTP PUT method in terms of idempotency?
- PUT requests are idempotent; repeating them gives the same result
- PUT requests are identical to DELETE
- PUT requests are unsafe for retries
- PUT requests always update multiple resources
Pagination Link Header Usage
In REST APIs, how does the Link header assist in paginated responses?
- It provides URLs for navigating to the next, previous, or related pages
- It encrypts the response body for security
- It contains the user credentials
- It lists all field names in the resource