Question
I'm trying to figure out what would be the best approach on path parameter versioning, but haven't been able to find a good/trustful source.
Say you have two entities category
and product
and the following REST endpoint to obtain the products within a given category reference.
GET /categories/{categoryReference}/products
You entity has a legacy categoryReference
which needs to be supported as well, what would be the best approach. I've got two approaches on my mind. What would be the best way of doing it and why? (if there's other way, please feel free to add it).
Option 1: New Endpoint
Given that you have a "new" parameter the endpoint should be new:
GET /categories/oldCatRef/{oldCategoryReference}/products
Option 2: A query param
Given that you are modifying the query by filtering with a different param:
GET /categories/{oldCategoryReference}/products?usingOldCatRef=true