I have a REST endpoint that gets a list of customers in a JSON format.
GET /webservice/customers
{
"count" : 80267
"customers" : [
{
"id": 1,
"name": "John Doe",
"email" : "[email protected]"
},
{
"id": 2,
"name": "Michael Bay",
"email" : "[email protected]"
}
]
}
My client saves in a database the customers it loads, but to update this list it needs to load all the data everytime. Sometimes I can have more than 100 000 entities, which is really slow and consuming.
I'm looking for a way to get only the data that have changed since the last update.
I found some answers like the If-Modified-Since or the Etag system, but if a new update is needed, the webservice stills getting all the data.
I thought about a system where I send the timestamp of the last update in a header or a URL parameter, and the REST endpoint only returns the new or updated entities, and the ids of entities that have been deleted since the last update.
But I suppose that a lot of clever people had this issue before me and I'm wondering if there is a common method to solve this issue.
PS : I do not need paging as the data is used to count customers after applying some filters on the dataset.
I do not need paging as the data is used to count customers after applying some filters on the dataset
why don't you just return the count?/webservices/customers?filters=x&attribute=count