Bird
0
0

Consider a REST API endpoint:

medium📝 Predict Output Q4 of 15
Rest API - REST API Fundamentals
Consider a REST API endpoint:
GET /products/789

What is the expected behavior of this API call if product 789 exists?
AThe server returns the details of product 789 in a response body.
BThe server creates a new product with ID 789.
CThe server deletes product 789 from the database.
DThe server updates product 789 with default values.
Step-by-Step Solution
Solution:
  1. Step 1: Identify HTTP method

    GET is used to retrieve data from the server.
  2. Step 2: Analyze endpoint

    /products/789 targets a specific product resource.
  3. Step 3: Expected behavior

    The server should return the details of product 789 if it exists.
  4. Final Answer:

    The server returns the details of product 789 in a response body. -> Option A
  5. Quick Check:

    GET retrieves data [OK]
Quick Trick: GET requests fetch resource data [OK]
Common Mistakes:
MISTAKES
  • Confusing GET with POST or DELETE actions
  • Assuming GET modifies data
  • Expecting creation or deletion on GET

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes