HTTP Method for Updates
Which HTTP method is typically used to update an existing resource in a RESTful API?
- GET
- POST
- PUT
- DELETE
- PATCH
Resource Identification
What is the common way to uniquely identify a resource in a RESTful API?
- Through request headers
- By its metadata
- Using a URL
- Via cookies
- With JavaScript
Idempotency of GET
Which of the following HTTP methods is considered idempotent?
- POST
- PATCH
- GET
- ALL
- HEAD
Statelessness in REST
What does 'statelessness' mean in the context of RESTful APIs?
- The server does not hold any state about the client session on the server.
- The server always returns a state code.
- The client must send all necessary information in each request.
- Both the first and third option
- The API server is unable to track the clients actions
HATEOAS Explained
What does HATEOAS stand for in RESTful API design?
- Hypertext As The Engine Of Application State
- Hypertext As The Engine Of All Services
- Hypermedia As The Engine Of Application State
- Hypermedia As The Engine Of All Services
- Hypertext Application Transfer Engine Of Application State
HTTP Status Code for Success
Which HTTP status code generally indicates a successful creation of a resource?
- 200 OK
- 201 Created
- 204 No Content
- 400 Bad Request
- 500 Internal Server Error
Using Flask for API
Which Flask library is commonly used for defining request data structures and validating API requests?
- Flask-RESTful
- Marshmallow
- Flask-SQLAlchemy
- Flask-Login
- Request Library
Error Handling in REST
What is the best approach for handling API errors in a RESTful API, ensuring the client receives helpful information?
- Return a generic 500 error
- Return a custom error code with a detailed message in the response body
- Raise an exception and let the server handle it
- Log the error and continue processing
- Ignore the error as it is not the clients issue
API Versioning
What is a common practice for versioning a RESTful API?
- Using query parameters
- Using a custom header
- Using a date-based versioning scheme
- Including the version number in the URL
- No need for versioning
HTTP DELETE with Payload
Is it acceptable to send a payload with an HTTP DELETE request?
- Yes, always
- No, never
- Only for logging purposes
- It depends on the API design and server implementation
- Only if its encrypted