RESTful Endpoint Design Quiz: CRUD Operations Edition Quiz

  1. Selecting the Most RESTful GET Endpoint

    Which of the following endpoints follows RESTful conventions to retrieve a specific user's details by user ID?

    1. /users/123
    2. /getUser?id=123
    3. /fetchuser/123
    4. /user/info/123
    5. /users?id=123
  2. Endpoint for Creating Resources

    What is the most appropriate RESTful endpoint to create a new product in a products collection?

    1. POST /products
    2. POST /products/new
    3. PUT /products
    4. GET /products/add
    5. PATCH /products
  3. 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?

    1. PUT /books/101
    2. POST /books/101
    3. PATCH /books/101/update
    4. GET /books/101/edit
    5. DELETE /books/101
  4. Identifying a RESTful DELETE Operation

    Which is the correct RESTful endpoint to remove a comment with the ID 46?

    1. DELETE /comments/46
    2. GET /deleteComment/46
    3. POST /comments/delete/46
    4. REMOVE /comments/46
    5. DELETE /comments?id=46
  5. List Resources with Query Parameters

    How would you design an endpoint to list all orders placed after January 1st, 2024, following REST principles?

    1. GET /orders?createdAfter=2024-01-01
    2. POST /orders/filter
    3. GET /orders/after/2024-01-01
    4. GET /orders/since/2024-01-01
    5. GET /listOrders?date=2024-01-01
  6. Partial Update Pattern

    For partially updating a user's email, which RESTful operation and endpoint are correct?

    1. PATCH /users/55
    2. PUT /users/55/email
    3. PATCH /users?userId=55
    4. POST /users/55/updateEmail
    5. GET /users/55/edit/email
  7. Resource Nesting

    You want to retrieve all orders for a customer with ID 77. Which endpoint best follows RESTful best practices?

    1. GET /customers/77/orders
    2. GET /customers-orders/77
    3. POST /orders/by-customer/77
    4. GET /orders/customerid/77
    5. GET /orders?customer=77
  8. URI Pluralization

    According to RESTful conventions, which resource path is preferred for retrieving all blog posts?

    1. GET /posts
    2. GET /post
    3. GET /allPosts
    4. GET /blogs/posts
    5. GET /blogposts
  9. Status Code for Successful Creation

    When a resource is created via POST /articles, what HTTP status code should the server return?

    1. 201
    2. 200
    3. 204
    4. 202
    5. 301
  10. Avoiding Verbs in RESTful Paths

    Which RESTful endpoint avoids including action verbs in the path while updating a project?

    1. PUT /projects/42
    2. POST /updateProject/42
    3. PATCH /projects/update/42
    4. GET /editProject/42
    5. POST /projects/42/update