Suggested answer

API versioning ensures that changes to an API do not break existing consumers.

URL Path Versioning: Version number embedded in the URL (e.g., /api/v1/accounts, /api/v2/accounts). Salesforce's own REST API uses this approach (/services/data/v59.0/). Pros: Highly visible, easy to test in a browser, simple to route at the gateway. Cons: URLs proliferate, and technically violates REST principles (the same resource shouldn't have different URLs by version).

Header Versioning: Version specified in a custom request header (e.g., API-Version: 2). Pros: Cleaner URLs, aligns with REST principles. Cons: Harder to test/debug, invisible in browser URL bar, requires client implementation discipline.

Salesforce recommendation: Use URL path versioning for external APIs (matching Salesforce's own pattern). Always maintain backward compatibility for at least 2–3 major versions before deprecation. Document breaking changes clearly.

Practice content for interview preparation; not an official vendor answer. Verify details against current product documentation.

Community comments (0)

No comments yet.

Sign in or create a free account to add a comment. Comments are moderated before they appear.

Plain text only, 3–2000 characters. A moderator reviews every comment before it is published.