Reputation: 9303
I'm designing a REST web-service and have questions on best/proper design.
A search method should be POST, since identical requests don't have to return the same data, right? Also, is it better to do /search/term or /search and have term as post-var?
Also, what if a resource can be updated at any time, would the method to return it be a GET or a POST. It sounds best to be a GET, but since it can change over time, it isn't idempotent.
Upvotes: 4
Views: 874
Reputation: 4018
I recommend a GET with /search/term To update POST To create a new something PUT
Upvotes: 0
Reputation: 2634
Since you're not modifying the resource, I would recommend using a GET with the search term in the URL. Cache expiration on the page should be set appropriately (as with all other resources). In this case, you might even want to disable caching entirely.
Upvotes: 1