I am designing a RESTful service that best matches the principles of HATEOAS. As a result, I need a way for my cool URLs to return a list of links describing the options available. I use HAL-JSON to facilitate the data format so that everything is fine, but now I am considering which HTTP method should pull this out.
I'm sure I can stick with a simple GET, but after reading through the HTTP RFC, it seems that OPTIONS can fit the bill here. My only problem is in bold:
9.2 OPTIONS
The OPTIONS method is a request for information on communication options available in the request / response chain identified by Request-URIs. This method allows the client to determine the parameters and / or requirements associated with the resource, or server capabilities, without implying a resource action or initiating a resource search.
Responses to this method are not cached.
Can anyone with a lot of experience working with standards on the Internet explain why this is so? In my opinion, you will probably want clients to cache this result, at least for a short period of time, since in the fully HATEOAS system this call will most likely be made quite often to cross rel links in order to arrive at the operation, which you are looking for.
I also like some opinions about using OPTIONS vs a simple GET to extract operations from a cool URL.
source share