Bird
0
0

Which of the following is the correct syntax for a GET request URL to fetch a user with ID 5?

easy📝 Syntax Q12 of 15
Rest API - HTTP Methods
Which of the following is the correct syntax for a GET request URL to fetch a user with ID 5?
APOST /users/5
BPOST /users?id=5
CGET /users/5
DDELETE /users/5
Step-by-Step Solution
Solution:
  1. Step 1: Identify the HTTP method for reading

    GET is the correct method to read or fetch data, so the method must be GET.
  2. Step 2: Check the URL path for resource

    /users/5 is the typical RESTful path to get a user with ID 5. Other options use wrong HTTP methods.
  3. Final Answer:

    GET /users/5 -> Option C
  4. Quick Check:

    GET + resource path = correct syntax [OK]
Quick Trick: GET method + resource path fetches data [OK]
Common Mistakes:
MISTAKES
  • Using POST or DELETE instead of GET
  • Using query parameters incorrectly
  • Mixing HTTP methods and URLs

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes