mllm
mllm

Reputation: 17458

How do I update a web API resource by request while also reacting with backend?

How do you update (RESTful) resources in a web API from the client, when you also need the backend to take actions regarding these changes?

Let's say I have a RESTful web API with the following resources:

In the client (which is typically a mobile app), users can retrieve a list of some worker's projects. They can then modify each project in that list (update), delete, or create new ones. Changes must take place locally on the client side, until a "send" command is dispatched, only then the server should receive the updates. Kind of like a classic form use case.

The tricky part: I need the backend to take actions according to each change, both individually and also as a whole. For example:

  1. A user retrieved some worker's projects list, deleted a project, and also updated the due_date of another.
  2. According to this change, the backend needs to both send push notifications to all of that project's members, and also recalculate the relevant worker's priorities according the total change in their projects (one was deleted, another got postponed...).

How do I achieve this in the best way?

I'm using Django with Django Rest Framework for that web service.

Appreciate your help!

Upvotes: 0

Views: 120

Answers (0)

Related Questions