Sitemap
Javarevisited

A humble place to learn Java and Programming better.

Member-only story

REST API BEST PRACTISES #2

Stop Messing Up Your API Versions!

If you’re using /v1/products and /v2/products, this article is for you

6 min readFeb 8, 2025

--

All of my REST API BEST PRACTISES articles are added in this library.

If you are not a medium member, Read it here.
Dear Folks, Your 50 claps 👏👏 help the discussion [
article] reach more developers 👀 on Medium, and your comments 💬 make me to keep writing. Dont forget to checkout the responses💬 from other developers.

Recently, I got the requirement to update my API to a new version, also the old version running to support existing clients.

My original endpoint was /products.

So, I thought:

Let's switch to /v1/products the current version and /v2/products the new one. Simple, right?

GET /v1/products
GET /v2/products

This approach feels “yeah thats the way”,

BUT

It violates REST principles and creates maintaince hell.

Simpilicity Trap

@RestController  
@RequestMapping("/v1/products")
public class ProductControllerV1 { ... }

@RestController…
Javarevisited
Javarevisited

Published in Javarevisited

A humble place to learn Java and Programming better.

Sivaram Rasathurai
Sivaram Rasathurai

Written by Sivaram Rasathurai

ATL @Sysco | Architect of Oh Taxi App | 3.6M+ Impressions & 6K+ Reps with Java & Python Bronze badges in StackOverflow | Tips:

Responses (58)