Bird
0
0

You are designing a REST API for managing a library's book collection. Which HTTP methods correspond correctly to these actions?

hard📝 Application Q8 of 15
Rest API - REST API Fundamentals
You are designing a REST API for managing a library's book collection. Which HTTP methods correspond correctly to these actions?
  • Retrieve all books
  • Add a new book
  • Modify details of an existing book
  • Remove a book
APOST for retrieve, GET for add, DELETE for modify, PUT for remove
BGET for retrieve, POST for add, PUT for modify, DELETE for remove
CPUT for retrieve, DELETE for add, GET for modify, POST for remove
DDELETE for retrieve, PUT for add, POST for modify, GET for remove
Step-by-Step Solution
Solution:
  1. Step 1: Map HTTP methods to CRUD operations

    GET retrieves data, POST creates new resources, PUT updates existing resources, DELETE removes resources.
  2. Step 2: Match actions to methods

    Retrieve all books -> GET, Add new book -> POST, Modify book -> PUT, Remove book -> DELETE.
  3. Final Answer:

    GET for retrieve, POST for add, PUT for modify, DELETE for remove -> Option B
  4. Quick Check:

    CRUD matches HTTP methods [OK]
Quick Trick: GET-read, POST-create, PUT-update, DELETE-remove [OK]
Common Mistakes:
  • Mixing POST and GET methods
  • Using DELETE to add or modify
  • Confusing PUT with POST

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes