rest - HTTP response code for stale pagination -


i have web service runs sql query, sorted 1 of several columns, , returns single requested page (as in skip m limit n). ui in front of follows 'load more' pattern, accumulating loaded pages of results in 1 view.

the problem new , deleted records, can happen @ time, causing result of 'load more' wrongly aligned, , depending on sort being used, obscuring new records should shown. in addition automatic refresh on timer in frontend, i'm going add timestamp field restful request , response format allow webapp detect view should reloaded on 'load more' call.

my question is, http status code best fit signal? in reviewing codes don't see exact fit. thought of using 302 found link 'page 1', wonder if might cause unwanted caching of redirect. thought of 400 bad request, there's nothing wrong request, it's data needs reloaded.

pages served post /path call requested page provided in json body.

i'm not complete purist, make work without caching or other side effects acceptable, adhere rest principles as possible.

anything make work without caching or other side effects acceptable

responses post requests are not cacheable unless explicitly mark them such. can use combination of status code, response headers , response entity communicate “please reload” message client.

you can use conditional requests. include client’s timestamp in if-unmodified-since header. respond 412 precondition failed if client stale. client have know how reload.

you can try 307 temporary redirect, if encode pagination in /path, because upon receiving 307, (i’m assuming you’re doing ajax here) xmlhttprequest transparently re-submit same post request new location (at least chromium does). actual page json have include metainformation on range covers, client knows has replace rows, not append them.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -