Updating object data + set relation in one API call

Hi,

May I know what is the correct way to update both the data and set the relation in one api call ?
I tried using deepSave but it is only for adding additional related child. It doesn’t remove any child.

Is the correct way to do it by using unitofwork (transaction) ?

Hi @Francis_Thong

Yes, the best way is to use our Transactions API.
what lang do you use?

here is the doc for Codeless Transaction API - Backendless Codeless Development Guide

Regards, Vlad

Hi,

I’m using js on the client side. I’m able to get it to work with the unitofwork. Just wanted to confirm that i’m doing it the correct way.

The deepSave method is confusing me as the word seems to suggest that it can save related object as well. But only to find out that it can only insert additional related object if not found but will not remove any not inside the list.

Hi Francis,

When working with relationships, the Deep Save API applies the “accumulation” policy. This means the following: if a parent object in the database already has some related objects and you update the object with new child objects in the relation, these objects will be added to the relation. So it is possible to add and update related objects, but not to remove them.

Regards,
Stanislaw

Thanks for the information. :+1: