Bird
0
0

Which API style is most suitable and why?

hard📝 Application Q8 of 15
Rest API - REST API Fundamentals
You are tasked with creating an API that enables clients to request nested related data and specify exactly which fields to retrieve, minimizing over-fetching. Which API style is most suitable and why?
AREST, because it supports batch requests natively for nested data.
BSOAP, because it uses strict contracts ensuring all data is always returned.
CREST, because it uses multiple endpoints to fetch related resources separately.
DGraphQL, because it allows clients to specify nested queries and select precise fields.
Step-by-Step Solution
Solution:
  1. Step 1: Identify API requirements

    Clients need nested data and precise field selection to avoid over-fetching.
  2. Step 2: Compare API styles

    GraphQL supports nested queries and field selection in a single request.
  3. Step 3: Evaluate REST and SOAP

    REST requires multiple calls or over-fetching; SOAP returns fixed data per contract.
  4. Final Answer:

    GraphQL, because it allows clients to specify nested queries and select precise fields. -> Option D
  5. Quick Check:

    GraphQL excels at flexible, nested, and precise data fetching [OK]
Quick Trick: GraphQL enables nested, precise queries in one request [OK]
Common Mistakes:
  • Assuming REST supports nested queries in one call
  • Believing SOAP returns flexible data sets
  • Thinking REST batch requests handle nested data well

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes