What is best practice for data synchronization operation between client and server?
We have 2 (or more) resources:
cars-> year, model, enginetoys-> color, brand, weight
And we need to get updated resources from server in case of any updates on them. For example: someone made changes from another client on the same data and we need to transfer those updates to our client application.
Request:
http://api.example.com/sync?data=cars,toys (verb?)
http://api.example.com/synchronizations?data=cars,toys (virtual resource "synchronizations")
Response with mixed data:
status code: 200
{ message: "ok", data: { cars: [ { year: 2015, model: "Fiat 500" engine: 0.9 }, { year: 2004, model: "Nissan Sunny" engine: 1.3 } ], toys: [ { color: "yellow", brand: "Bruder" weight: 2 } ], } } or response with status code 204 if no updates available. In my opinion making separated http calls in not a good solution. What if we have 100 resources (=100 http calls)?