In REST webservice there is a possibility to say which verbs are possible for specified resource. Can I return any headers specifying that for GET one could pass param, say, ‘name’ so client knows that he could make:
GET /resource?name=foo
In REST webservice there is a possibility to say which verbs are possible for
Share
You can make new headers if you like, but they wouldn’t be very much in line with the design of the protocol. First of all, it’s important to understand that "/bar" identifies a resource, and "/bar?name=foo" identifies a different resource, not the same resource with parameters. I know this is counter to the design of many popular web frameworks, but it’s essential for understanding how to use the protocol correctly.
Based on that, the OPTIONS method should return information about the identified resource, which means that
OPTIONS /barshould return a response about the communication options of the/barresource, not the/bar?name={name}set of resources. Note also that OPTIONS has no format specified for a payload; the only interoperable exchange is via well-known headers like Allow.The proper way for a representation of the resource
/barto contain information about the resource/bar?name=foois via links (or forms, some of which are a means to construct links), either in the payload (if the media type supports it) retrieved fromGET /bar, or in the response headers (more and more commonly via the Link header). Look into URI Templates for an alternative to HTML forms.