Bird
Raised Fist0

In header-based versioning for REST APIs, which HTTP header is primarily used by clients to indicate the desired API version?

easy🧠 Conceptual Q2 of Q15
Rest API - Versioning Strategies
In header-based versioning for REST APIs, which HTTP header is primarily used by clients to indicate the desired API version?
AUser-Agent
BContent-Type
CAuthorization
DAccept
Step-by-Step Solution
Solution:
  1. Step 1: Identify the header used for content negotiation

    The Accept header is used by clients to specify the media types they can handle.
  2. Step 2: Understand versioning via media types

    Header-based versioning commonly encodes the API version within the Accept header's media type, e.g., application/vnd.example.v1+json.
  3. Final Answer:

    Accept -> Option D
  4. Quick Check:

    Version info is in Accept header [OK]
Quick Trick: API version is sent in Accept header [OK]
Common Mistakes:
MISTAKES
  • Confusing Content-Type with Accept header
  • Using Authorization header for versioning
  • Assuming User-Agent carries version info

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes