API Maker

The backend engine for the AI era

Chapters

What you will learn

  • A tree across PostgreSQL and MySQL, in one call
  • The ids filled in for you
  • One bad line: nothing written anywhere
  • The tree saved, and read back with deep
  • How master save writes it
In the docsMaster save
Transcript440 words · click a time to play from there

Intro

One call writes a tree of rows : a customer in PostgreSQL, her order and its lines in MySQL. And when one row is wrong, nothing is written, in any database.

A tree of rows, the usual way

Saving a customer with her first order usually means three calls, one per table, in the right order, ids carried by hand from one call to the next, and a failure halfway that leaves half an order behind : no transaction spans two databases. With API Maker, one master save, the tree as it is, each row given the id of the row it belongs to, and a failure takes everything back, in every database.

In this video : a tree across two databases, one bad line, the tree saved, and read back.

A tree across two databases

API Testing, postgres, crm, customers, Master save. A new customer, Tara Kapoor. Under orders, her first order, in MySQL : the virtual field of video eleven. Under items, its two lines, in MySQL too. The second quantity is written in words.

All or nothing

Four hundred : the quantity of a line. The customer was already saved in PostgreSQL, the order and the first line in MySQL : all three were taken back. Nothing is left, in either database. Two, as a number. Two hundred and one : the customer, with her new id. Her order got that id as its customer_id, and each line the id of the order.

Read back

Query for get data : her e-mail, and deep, her orders, and their items. The customer from PostgreSQL, her order and its two lines from MySQL, in one answer.

How it is written

The writes follow the relations. A row a field points to is saved first, and its id is written in that field. The rows under a virtual field are saved after their parent, with its id. Every write is noted : when one fails, the others are taken back, the last one first.

Good to know

A row that carries its primary key is updated, not inserted : one tree can save and update. Every row goes through the schema of its own table : conversions and rules. From code, g.sys.db.masterSave does the same. And if a take-back itself fails, the answer says so, next to the error that started it.

Built on standards

One call for a tree of rows. All or nothing, across databases. So a client, written by you or by an AI assistant, never leaves half an order behind.

Recap

To sum up. One master save, a tree across databases. Each row given the id it needs. One bad row, nothing written anywhere. The tree read back with deep. Next : deep populate, in depth. API Maker. Build faster, spend smarter, deliver better.