Want a REST api request to include a good idea in a cookie?

My idea is to consider the URIs in my vacation as a unique resource, with the exception of the client’s location context, which is stored in a cookie. Are there any flaws in this approach?

+3
source share
3 answers

From a philosophical point of view, this is not really REST unless you uniquely identify the resource by URL (at least for my reading of Fielding ).

From a practical point of view - and this is based on experience - you are in a world of pain if you need calls to web services to use cookies. First of all, because it is part of the information that must be managed in a different way of the code, making your code on the client side more complex. You will also encounter problems with the domain and proxy servers (especially if you share a cookie between the service and a traditional web application), and it will not be transferred between clients.

If you want to create different content based on location, why not use the geolocation service?

: URL- ? cookie , JavaScript. , .

+2

API, . , HTTP, cookie HTTP- , , , URL-.

+1

. A, , B , .

0

Source: https://habr.com/ru/post/1712286/


All Articles