Timeline for How to deal with multiple "entry points" for an action in a REST API?
Current License: CC BY-SA 3.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 24, 2014 at 11:59 | comment | added | seldon | Cache invalidation could be an issue, actually. But thinking about it, the two entry points doesn't return the same resource, and the cache would be invalidated anyway with a single path. Moreover, I expect the API clients to be consistent with the path used. This could be pinpointed in the documentation. | |
Oct 24, 2014 at 11:40 | comment | added | superbob | @mattecapu, as I said before, this is not a dogmatic answer, both ways can be considered right. And I was not considering the implementation that is not, as you said it, more complicated when choosing the 2-paths approach. To add further arguments, one can also consider HTTP caching mechanisms : If you want to cache your GET requests, you must invalidate simultaneously your 2 path options whereas using the single path approach make it more simple. | |
Oct 24, 2014 at 9:45 | comment | added | seldon | Thank you for the answer! The simplicity argument is good, yet I'm not totally convinced. As in my example, cases without any clear preference over the two methods can be common. If behind my API I have a routing system, attaching the same code to both the URLs will be easy, and then we provide the user with a complete API. | |
Oct 24, 2014 at 9:41 | history | answered | superbob | CC BY-SA 3.0 |