3 ms·
No, this is incorrect. If you have versions in your url, then the same client (eg, with ID 1) has two resource identifiers, /v1/clients/1 and /v2/clients/1. In
by psadauskas 16y ago
No, this is incorrect. If you have versions in your url, then the same client (eg, with ID 1) has two resource identifiers, /v1/clients/1 and /v2/clients/1. In fact, you have the same resource, /clients/1, but multiple versions of the representation. There's links further down, the one by Peter Williams in particular, that describes a way to do this using content negotiation and the Accept header.
Updating is easy, just add the representations to the resources that need the newer version (eg, "views" in rails). Updating with a new v2 in your URI means updating ALL your resources, or writing lots of redundant code to route multiple incoming uris to the same resource. This gets unmanageable, fast.
Putting versions in the URI increases complexity, for you, and writers of clients.
- epochwolf 16y ago> Putting versions in the URI increases complexity, for you, and writers of clients. Perhaps, but it you have tests for your api you can tell if you break them. Also, there is no reason you need to duplicate code if a section of the api didn't change. You only need to duplicate code if something major changes. Everything else can just be silently routed to the previous version's interface.