We are developing the RESTful services for search operations. As per REST Specs, since we are fetching the data from the server, it must be GET HTTP Method. But, we have to search on a huge number of parameters and this list can extend in future too. And, there is a limit to the query URL length, so, all search parameters can't be able to fit in the query URL. So, how can we implement this search?
Not really forbid, but POST is used when you want to make a non-idempotent change on the server. I agree with Vaibhav that a GET is more appropriate.
However, when technical limitations bind your hands, you don't really have a choice. I would use PUT rather than POST though, as PUT indicates you can replay the request and it will return the same results, as long as the server state hasn't changed between the two requests.
Vaibhav Gargs wrote:We are developing the RESTful services for search operations. As per REST Specs, since we are fetching the data from the server, it must be GET HTTP Method. But, we have to search on a huge number of parameters and this list can extend in future too.
Your RESTful API should be focused on the exchange of specific resources. When GETing a resource from a server, the client should already know what type of resource it wants the server will provide, and the majority of the parameters which describe the resource should be in the URI's resource path, not query parameters. A quick example:
Stephan van Hulst
posted 6 months ago
Do you have a source for that Ron? What makes it not RESTful?
So i am working on something that will completely eliminate the need for coding for setting up a web server for answering REST web services or needing to sign up to a database provider like Oracle Rest Data services. The solution will allow business users to create dataflows and workflows for defining business logics for individual responses for REST requests.
I am just interested in knowing how much this project will gain traction among business users and developers.
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
Create Edit Print & Convert PDF Using Free API with Java