Support Topics Documentation Slack YouTube Blog

Updating many relations from object in one API call

Hello,

Is there a way to update an object relation (through REST API) for more than one relations using just one call?

Right now based on documentation I understand that to update 2 different relations (where I would like to remove 2 objects and add another objects), I would need to make 4 calls:

  • to remove one object from one relation
  • to remove one object from second relation
  • to add one object from first relation
  • to add one object to second relation

Am I missing something?

Hi Jakub,

What you described is possible with a single API call, but you’d need to use the Transactions API for that:

Regards,
Mark

Hello Mark,

This works good, however I have a specific use case - could you please advise whether the transaction API can be used to upload a file and then add a file reference to the db record?
Since there is no specific table for the files I am not sure whether this can be easily done.

Thank you,
Jakub

Hi Jakub,

File upload is an atomic operation and can be executed outside of a transaction. There is no operation in the transaction API for file upload since it doesn’t do anything with the database.

Regards,
Mark