REST APIs and HTTP methods exam review
A comprehensive study set for understanding REST APIs and HTTP methods, focusing on key concepts, definitions, and practical applications in a college-level computer science context.
Quiz(36 questions)
1. What does the 'Client-Server' architecture in REST imply?
Terms in this Study Set(36)
REST API Basics(16)
What does REST stand for?
Representational State Transfer.
Define a REST API.
An application programming interface that conforms to the principles of REST.
True or False: REST APIs use stateful sessions.
False. REST APIs are stateless; each request from a client contains all information necessary.
List key principles of REST.
- Stateless - Client-Server architecture - Cacheable - Layered system - Uniform interface
What is statelessness in REST?
Each request must contain all data to complete the request, no session information is stored.
Fill in the blank: REST APIs typically use _____ for communication.
HTTP.
How does a REST API differ from a traditional API?
REST APIs use standard HTTP methods and are stateless, while traditional APIs may not.
What is a resource in REST?
An object or representation of something, usually identified by a URI.
True or False: REST APIs can only return JSON format.
False. They can return various formats, including XML and HTML.
Name an advantage of using REST APIs.
- Scalability - Flexibility - Simplicity of integration
Describe the Client-Server architecture in REST.
Client and server are separate; clients request resources and servers provide them without needing to know the client details.
What is a URI in REST?
A Uniform Resource Identifier that uniquely identifies a resource.
How does caching work in REST?
Responses are cacheable to improve performance and reduce server load.
What does the uniform interface principle enforce?
Consistent and standardized communication between clients and servers.
Example of a RESTful resource retrieval.
GET /users/1 retrieves the user with ID 1.
What is HATEOAS?
Hypermedia as the Engine of Application State; clients interact dynamically with applications through hyperlinks.
HTTP Methods(20)
GET method → primary use?
Retrieve data from the server. - Safe operation - Idempotent
What does POST do?
Creates a new resource on the server. Sends data in the request body.
True or False: GET requests can change server data.
False. GET requests should never modify data as they are intended for retrieval.
Difference between PUT and PATCH?
PUT updates/creates a resource fully. PATCH updates a resource partially.
DELETE method → purpose?
Removes a resource from the server. - Idempotent - Can affect state
Fill in the blank: PUT is used to _____ a resource.
update or create
Example of a GET request?
GET /api/users/123 - Retrieves user data for user with ID 123.
When to use POST instead of GET?
Use POST when submitting data that changes state, like creating users.
What does the DELETE method return?
Usually returns a status code like 204 (No Content) if successful.
True or False: POST is idempotent.
False. Multiple POST requests may create multiple resources.
GET vs POST: Which one is cached?
GET requests can be cached, while POST requests are typically not cached.
Use case for PATCH method?
To update a user's email without affecting other user data.
What status code does a successful DELETE return?
204 No Content or 200 OK depending on the API design.
GET request with parameters example?
GET /api/products?category=shoes - Retrieves products in the shoes category.
Main difference between PUT and POST?
PUT is idempotent; POST creates resources without guaranteeing uniqueness.
True or False: Sending a GET request with sensitive data is safe.
False. GET data is visible in URLs and logs, making it insecure.
What does status code 201 indicate?
Created: Indicates a successful POST request that created a resource.
Purpose of OPTIONS method?
Describes the communication options for the target resource.
Example of a PUT request?
PUT /api/users/123 - Updates user data for user with ID 123.
Use case for DELETE method?
To remove a user from a database.
Questions in this Study Set(36)
1. What does the 'Client-Server' architecture in REST imply?
2. What is the primary purpose of the GET method?
3. Which HTTP method is primarily used to retrieve data from a REST API?
4. Which HTTP method is used to create a new resource on the server?
5. True or False: REST APIs are designed to be stateful.
6. True or False: Using GET requests can modify server data.
7. Which of the following is NOT a key principle of REST?
8. What distinguishes PUT from PATCH?
9. What is the primary function of a URI in a REST API?
10. What is the primary action of the DELETE method?
11. Fill in the blank: REST APIs usually respond in _____ format.
12. Fill in the blank: PUT is used to _____ a resource.
13. What does it mean for a REST API to be cacheable?
14. What is an example of a valid GET request?
15. Which of the following methods is used to update an existing resource in a REST API?
16. When should you use POST instead of GET?
17. Which statement best describes HATEOAS?
18. What does a successful DELETE method typically return?
19. Which HTTP method is used to delete a resource in a REST API?
20. True or False: POST is considered an idempotent method.
21. True or False: REST APIs can only communicate over HTTPS.
22. Which HTTP method can be cached by default?
23. Which of the following best describes the uniform interface principle in REST?
24. What is a common use case for the PATCH method?
25. In REST, which HTTP method is used primarily for creating new resources?
26. What status code indicates that a resource was successfully created?
27. What does REST focus on in terms of resource representation?
28. What does the OPTIONS method do?
29. What does RESTful architecture emphasize in its communication between client and server?
30. What is an example of a valid PUT request?
31. Which of the following best defines a resource in the context of REST?
32. In what scenario would you use the DELETE method?
33. Which of the following is NOT a primary HTTP method?
34. True or False: GET requests can safely include sensitive data in the URL.
35. What is the result of sending a valid PATCH request?
36. Which HTTP method is primarily used to partially update a resource?
Related Study Sets
Wiederholung: HTML CSS JavaScript Rollen
Wiederholung: Browser lädt eine Seite
Test: Was eine URL ist
What a URL is
HTML vs CSS vs JavaScript step by step
How a browser loads a page
JavaScript DOM and events notes
HTML CSS en JavaScript stap voor stap
Create Your Own Study Set
Upload a PDF, paste your notes, or describe a topic – AI generates flashcards, quizzes and more in seconds.

