tags:

views:

123

answers:

1

If I have a HTTP based RESTful service and I want to POST a search resource and use the PRG pattern for returning the URL to the search-result resource, I have to persist the search-result resource on the server.

Is this a good idea?

If I do persist the search-result resource how long is it persisted for?

Can I control this by a HTTP header of some kind?

Cheers

AWC

+1  A: 

I don't think REST or HTTP can provide you with any guidance on this. How long the search results should persist for is purely a function of how big they are, how expensive they are to calculate, how dynamic the data is, how often the same results are requested and how much money do you want to spend on hardware to get performance.

Having said that, you could use 410 Gone to interesting effect. After a period of time you could throw away the results but keep the query parameters and saved resource url. If you get a request to that URL after the results have been thrown away, you could return 410 Gone with the query parameters in the body. The client could be prompted to decide if they want to re-issue the query.

Depending on the data, you could even hide the re-query from the client. However, depending on the type of data being returned that could be misleading to the client.

Darrel Miller
thanks for the info...
AWC