API Maker

The backend engine for the AI era

Chapters

What you will learn

  • Keys in the case the client asks for
  • JSON, XML or YAML
  • Flat objects
  • Meta: the timing and details of a call
  • Encrypted and compressed answers
  • Every header, in one list
In the docsRequest headers
Transcript477 words · click a time to play from there

Intro

The client chooses the shape of the answer : the case of its keys, JSON, XML or YAML, nested or flat, with its timing, or encrypted. A header each, and no code on the server.

Shaping answers, the usual way

Shaping answers usually means a mapping layer per client to rename keys, an XML or YAML exporter written beside the JSON one, and timers added by hand to find a slow call. With API Maker, the client asks with a header, every API of every table answers it, and the timing and the group of a call come on request. In this video : the case of the keys, XML and YAML, flat objects, meta, an encrypted answer, and every header on one page.

The shape of the answer

API Testing, the customers, Get all : two rows, three columns. Snake case, as the table has it. The Header tab : x-am-response-case, camelCase. firstName, lastName, loyaltyTier : for a JavaScript client, without a mapping layer. Back to noChange. x-am-content-type-response, text slash xml : the same envelope, as XML. text slash yaml : as YAML. Now the orders of MySQL, with their customer from PostgreSQL, by deep : a nested object.

x-am-response-object-type, make_flat : one level, customer_id_first_name, ready for a grid or a CSV file.

Meta and encryption

x-am-meta, true : the time spent in API Maker, and the group that let the call in. For a call which runs code, the server and the sandbox which ran it too. x-am-get-encrypted-data, get_only_encryption : data is null, and encryptedData holds the answer, encrypted with the transfer key of the secret. The app decrypts it with the same key, and gets the same rows.

Compressed answers

One more header, the one every HTTP client sends : accept-encoding. A thousand order events : over a hundred kilobytes, as they are. Asked with br : several times smaller, the same rows. With gzip, about the same. x-no-compression, true, turns it off for one call. And an answer under fifty kilobytes goes as it is : the threshold is a setting of the server. Rows of a stream are never compressed.

Every header on one page : who calls, the shape of the answer, the cache, the encryption and the language, and where the code runs.

Good to know

x-am-cache-control, reset_cache, drops the cached answers before a call : video twenty nine. x-am-encrypted-payload says the body itself comes encrypted. x-am-internationalization gives the messages in a language : video thirty four. And every answer says where it came from : x-am-data-source, api or cache.

Built on standards

The client chooses the shape, the server does the work. One implementation, for every API of every table. So a client written by an AI assistant sets a header, instead of writing a mapper.

Recap

To sum up. Keys in any case. JSON, XML or YAML. Nested or flat. Meta, and encryption, on request. Next : custom APIs, the first steps. API Maker. Build faster, spend smarter, deliver better.