Thursday, April 18, 2013

The HTTP OPTIONS method and potential for self-describing RESTful APIs | zacstewart.com

The HTTP OPTIONS method and potential for self-describing RESTful APIs | zacstewart.com: "What is the HTTP OPTIONS method?

To quote the spec:

This method allows the client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval.

Minimally, the response should be a 200 OK and have an Allow header with a list of HTTP methods that may be used on this resource. As an authorized user on an API, if you were to request OPTIONS /users/me, you should receive something like…

200 OK
Allow: HEAD,GET,PUT,DELETE,OPTIONS"

'via Blog this'