Bird
Raised Fist0

What will be the output URL of the self link if the resource ID is 100 and the base API URL is https://api.example.com/users/?

medium📝 Predict Output Q5 of Q15
Rest API - HATEOAS and Linking
What will be the output URL of the self link if the resource ID is 100 and the base API URL is https://api.example.com/users/?
Ahttps://api.example.com/users
Bhttps://api.example.com/users/100
Chttps://api.example.com/users?id=100
Dhttps://api.example.com/users/self/100
Step-by-Step Solution
Solution:
  1. Step 1: Understand self link URL construction

    Self link appends the resource ID to the base URL path.
  2. Step 2: Combine base URL and ID correctly

    Appending 100 to https://api.example.com/users/ gives https://api.example.com/users/100.
  3. Final Answer:

    https://api.example.com/users/100 -> Option B
  4. Quick Check:

    Self link URL = base URL + resource ID [OK]
Quick Trick: Self link URL = base URL + resource ID path [OK]
Common Mistakes:
MISTAKES
  • Using query parameter instead of path
  • Omitting resource ID
  • Adding extra 'self' segment

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes