In the design of the API, you should not return the URI as part of the data in the HTTP API response. There is a header field here , if your resource is accessible from several URIs, and the domain logic of your application, along with a good name for the URI, should allow you to guess the location of the resource.
For example, if {'name':'foo', 'id':100} is Foo , you (and users) usually expect its URI to be /foos/100 , so why do you need to return the URI inside the response data?
Now itβs more pragmatic, since support for these trendy HTTP headers can make it difficult for your API to accept the API, I believe that you should store URIs in a 1: lot relationship with your resources, if you expect your resources to change URIs often (I hope they donβt do), so it might be easier for you to support call forwarding with 301 Moved Permanently for older ones. In addition, I see no reason not to generate them on the fly, since you will have to redirect to old controller actions that respond to old URIs manually if you use the MVC structure.
source share