API Timestamp Design -


quick question got new related app plan design need know best method update app new data rather keep loading api idea of pull new data @ time app installed, previous data not loaded in app

currently planned this way

1) first run use current time stamp , store timestamp

2) second call call previous timestamp of (1) , store current 1 (2)

3) third call we call previous timestamp of (2) , store current 1 call (3)

now if new data has been added between calls of timestamp api reflect api show new data has been added

so example

1) first call www.site.com/datetime=1234567890

this return no items

in between time new data added

2) second call (take previous timestamp , store current timestamp) previous:www.site.com/datetime=1234567890

new: www.site.com/datetime=1234567891

this return data in api

3) 3rd call (take previous timestamp , store timestamp)

previous: www.site.com/datetime=1234567891 new: www.site.com/datetime=1234567899

would work or there better way of doing it?

we dont want load api every single time each new timestamp query returning new items if applicable

typically done conditional headers, such if-modified-since if want use timestamp, or if-none-match if wanted use etag versioning instead. can see rfc 7232 more information on conditional headers.

typically api broken multiple resources, you're getting chunks have changed rather having all-or-nothing.


Comments