3 ms·
you are somewhat missing the point. the idea of proper REST is that you NEVER should generate your urls. you take them from the resources. now suppose you have
by Vitaly 15y ago
you are somewhat missing the point. the idea of proper REST is that you NEVER should generate your urls. you take them from the resources. now suppose you have an application that consumes RESTful API.
if you do it "wrong" you probably store record ids in your local db and then access stuff from the API by constructing your own urls.
a more proper way of doing it is to store the compete resource urls and not just ids. but in this case you have a version update problem. When you release a new version of the app that supports new version of the API you will now need to go over all the stored resource urls and update the version, probably doing some regexing etc.
with version in the headers you can store full resource urls and not have to change them every time api version changes.