The Deep Save API leverages the capabilities of the Transaction API to allow you to save related data objects in multiple tables simultaneously within a single API call.
While the previous line may sound incredibly complex – and the inner workings of it certainly are – the real-world application of this new API are abundant.
In simpler terms, the Deep Save API enables you to save multiple data objects at the same time with one API call, on the basis those objects are related.
The Deep Save API functions similar to our Transaction API (laid out in much more detail in the docs). Both combine multiple database operations into a single API call to reduce the number of API calls impacting your backend. By doing so, you not only reduce your API consumption (read: saving you money), you also protect your database integrity.
Let’s take a look at some examples.
Let’s say you have a
Person data table and an
Address data table. A person’s home address is a relation with an object in the
Address table. This is illustrated below:
In this scenario, the
Address table is a “branch” of the Person table’s “object tree”. Another branch could be
employerAddress, for example.
With the Deep Save API, you are able to create or update the parent object and any or all branches in a single API call. Previously, each branch table updated would consume an additional API call, increasing the API cost of some common transactions significantly.
With the Deep Save API, all of the branches of the parent’s object tree can be updated at once.
The Deep Save API Codeless block looks like this:
Let’s look at our previous example tables –
Address – from above. Say we want to create our Bob
Person to match the entry above. Here’s what we have:
In Codeless, this will look like:
Once the code runs, you will find two objects in your database. Notice that a single Deep Save API call resulted in both objects saved in the corresponding tables and a relationship in the
homeAddress column in the
Person table points to the
The Deep Save API is just one of the powerful new features in this release. You can read our articles about the other new features released below:
Thanks for reading, and Happy Visual App Building!