API Fundamentals
/Advanced
Header Versioning
Definition
A versioning strategy where the URL remains exactly the same, but the client specifies which version of the API they want by sending a custom HTTP Header.
Explain Like I'm New
You only have one URL: `/api/users`. But when you send the request, you attach a sticky note (Header) that says 'Please give me the 2022 version of this data'. The server reads the sticky note and formats the data accordingly.
Real World Example
GitHub's API uses a custom Accept header: `Accept: application/vnd.github.v3+json`. Stripe uses a custom Stripe-Version header: `Stripe-Version: 2023-10-16`.
Common Use Cases
- •Enterprise APIs
- •REST purist design
Interactive Example
Loading...
Console output will appear here...
Interview Questions
basic
- Which versioning strategy is easier for a non-developer to test in a web browser: URL Versioning or Header Versioning?
intermediate
- What is 'Content Negotiation' in the context of Header Versioning?