ruby on rails - How do you GET a RESTful resource by something other than ID? -


There can be a situation where excluding the ID, the object will need to find an object.

For example, I would like to get the username and password by user , so strictly stout " Received / user / 1 "will not work.

To get all the examples of a resource, according to the URL pattern: " received / user " I can add that parameter: " GET / users? Username = Joe & password = topsecret ", but it will impersonate the official purpose of the GET request.

"get / user? Username = joe and password = topsecret" The official purpose will clone. "No, this is not anything inverted. It is absolutely correct and it is the right way to do it, and this is an inappropriate way to get dynamic results in http spec. This is unique. The URL cares for the rest of the architecture, as long as it is the only way to get there, and it does not take anywhere else.

http to return a dynamic query to a query string protocol. Of Looking at the current situation, the query string you provide should always return the same result. URL Aesthetics is a separate issu REST completely by E..

According to the REST architecture, The rules of the GET request are that it always gives the same result (or has similar results for the same time, so caching works), and GET does not have side effects to get idempotent (always Neither the results are back, regardless of how often you say it) and the system is not the reason for changing the state. It is it .

Definitely You do not have to use the query protocol. You can put parameters in the forward slash, between the semicolon, or this base 64 encoded GUID. This is entirely up to you, as long as it adheres to simple rules.


Comments