0

I'am developing a mobile web application Tasks (for iPhone) with a local database (using json files) so my app is still usable when the user is offline.

This is working perfectly, but I want to save the local data on a server. So I need to synchronize the local DB with a DB on a server (using REST(ful)way).

What I want to do is:

Collect all tasks and send to the server. At the moment I see two options to do this:

Send each task to the server: POST /tasks

I actually don't want to do this because I want to limit the number of requests to the server so option 2:

Collect all the tasks and send them to the server at once.

Is there any way to do this with (maybe with slimframework php) ?

Hassan Bendouj
  • 311
  • 1
  • 8
  • 14

1 Answers1

0

I guess that you want to do some bulk updates on your RESTful application.

In fact, the method POST on the list resource /tasks is generally used to add an element but it can also be used to add more than one element. In such case, you need to support a parameter (something in a dedicated header) to determine which "action" to execute on the method POST.

A method PATCH can also be used for such use case. This is typically designed for this and can contain a list of operations to do for elements (add, delete, update).

I think that these two answers could give you some more hints:

Hope this helps you, Thierry

Community
  • 1
  • 1
Thierry Templier
  • 198,364
  • 44
  • 396
  • 360