Bird
0
0

Why might an API ignore unknown fields specified in a sparse fieldsets request like /posts?fields[posts]=id,title,unknownField?

hard📝 Conceptual Q10 of 15
Rest API - Advanced Patterns
Why might an API ignore unknown fields specified in a sparse fieldsets request like /posts?fields[posts]=id,title,unknownField?
ATo maintain backward compatibility and avoid errors
BBecause the API always returns all fields regardless
CBecause unknown fields cause the API to fail
DBecause sparse fieldsets only accept one field at a time
Step-by-Step Solution
Solution:
  1. Step 1: Understand API behavior with unknown fields

    APIs often ignore unknown fields to avoid breaking clients and maintain compatibility.
  2. Step 2: Identify correct reason

    This prevents errors and allows clients to request fields safely even if some are unsupported.
  3. Final Answer:

    To maintain backward compatibility and avoid errors -> Option A
  4. Quick Check:

    Unknown fields ignored for compatibility = To maintain backward compatibility and avoid errors [OK]
Quick Trick: APIs ignore unknown fields to avoid breaking clients [OK]
Common Mistakes:
MISTAKES
  • Thinking unknown fields cause errors
  • Assuming all fields always return
  • Believing only one field allowed

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes