Selecting the Most RESTful GET Endpoint
Which of the following endpoints follows RESTful conventions to retrieve a specific user's details by user ID?
- /users/123
- /getUser?id=123
- /fetchuser/123
- /user/info/123
- /users?id=123
Endpoint for Creating Resources
What is the most appropriate RESTful endpoint to create a new product in a products collection?
- POST /products
- POST /products/new
- PUT /products
- GET /products/add
- PATCH /products
Choosing the Correct HTTP Verb for Updating
Given a RESTful API for books, which operation would you use to update all fields of a book with ID 101?
- PUT /books/101
- POST /books/101
- PATCH /books/101/update
- GET /books/101/edit
- DELETE /books/101
Identifying a RESTful DELETE Operation
Which is the correct RESTful endpoint to remove a comment with the ID 46?
- DELETE /comments/46
- GET /deleteComment/46
- POST /comments/delete/46
- REMOVE /comments/46
- DELETE /comments?id=46
List Resources with Query Parameters
How would you design an endpoint to list all orders placed after January 1st, 2024, following REST principles?
- GET /orders?createdAfter=2024-01-01
- POST /orders/filter
- GET /orders/after/2024-01-01
- GET /orders/since/2024-01-01
- GET /listOrders?date=2024-01-01
Partial Update Pattern
For partially updating a user's email, which RESTful operation and endpoint are correct?
- PATCH /users/55
- PUT /users/55/email
- PATCH /users?userId=55
- POST /users/55/updateEmail
- GET /users/55/edit/email
Resource Nesting
You want to retrieve all orders for a customer with ID 77. Which endpoint best follows RESTful best practices?
- GET /customers/77/orders
- GET /customers-orders/77
- POST /orders/by-customer/77
- GET /orders/customerid/77
- GET /orders?customer=77
URI Pluralization
According to RESTful conventions, which resource path is preferred for retrieving all blog posts?
- GET /posts
- GET /post
- GET /allPosts
- GET /blogs/posts
- GET /blogposts
Status Code for Successful Creation
When a resource is created via POST /articles, what HTTP status code should the server return?
- 201
- 200
- 204
- 202
- 301
Avoiding Verbs in RESTful Paths
Which RESTful endpoint avoids including action verbs in the path while updating a project?
- PUT /projects/42
- POST /updateProject/42
- PATCH /projects/update/42
- GET /editProject/42
- POST /projects/42/update