onejigtwojig onejigtwojig - 1 month ago 5x
reST (reStructuredText) Question

Rest Standard: Path parameters or Request parameters

I am creating a new REST service.

What is the standard for passing parameters to REST services. From different REST implementations in Java, you can configure parameters as part of the path or as request parameters. For example,

Path parameters

Request parameters

Does anyone know what the advantages/disadvantages for each method of passing parameters. It seems that passing the parameters as part of the path seems to coincide better with the notion of the REST protocol. That is, a single location signifies a unique response, correct?


Paths tend to be cached, parameters tend to not be, as a general rule.


GET /customers/bob


GET /customers?name=bob

The first is more likely to be cached (assuming proper headers, etc.) whereas the latter is likely not to be cached.