Discussions

Ask a Question
Back to all

How do you handle API versioning for microservices? Seeking best practices.

sprunki phase 5

Hey everyone,

We're starting a new microservices project and trying to decide on the best way to handle API versioning from the get-go. We want a strategy that’s scalable and won't cause headaches down the road when we need to make changes.

I'm looking for some real-world advice on what methods you've found most effective. What's your preferred approach? For example, do you use path-based versioning (/v1/resource), header-based versioning (Accept: application/vnd.myapi.v1+json), or something else?

I'm leaning towards path-based for its simplicity and clear URLs, but I've heard arguments that header-based is cleaner and more flexible. What are the common pitfalls and best practices you've encountered with either approach, especially in a microservices environment? Any insights from your experience would be really helpful. Thanks!