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
Transcript590 words · click a time to play from there

Intro

In API Maker, the client chooses the shape of the answer. It can pick the case of the keys, JSON, XML, or YAML, nested or flat objects, timing details, or an encrypted answer. Each one is a header, with no code on the server.

Shaping answers, the usual way

Shaping answers is usually extra work. You write a mapping layer for each client, to rename keys. You write an XML or YAML exporter next to the JSON one. And you add timers by hand, to find a slow call. With API Maker, the client asks with a header. Every API of every table understands it. And the timing and the group of a call come when you ask. 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

Open API Testing. Pick the customers, and the API Get all. We ask for two rows, and three columns. Send. The keys are in snake case, like in the table. Now open the Header tab. Set x-am-response-case to camelCase. Send. Now we get firstName, lastName, and loyaltyTier. That is ready for a JavaScript client, with no mapping layer. Set it back to noChange. Now set x-am-content-type-response to text slash xml.

Send. We get the same answer shape, as XML. Now text slash yaml. And we get YAML. Now the orders of MySQL, with their customer from PostgreSQL, by deep. Send. The customer is a nested object. Set x-am-response-object-type to make_flat. Send. Now there is one level, with keys like customer_id_first_name. It is ready for a grid, or a CSV file.

Meta and encryption

Now set x-am-meta to true. Send. We see the time spent in API Maker, and the group that let the call in. For a call that runs code, we also see the server and the sandbox that ran it. Only the admin panel gets this. Other callers get the answer without it. Now set x-am-get-encrypted-data to get_only_encryption. Send. data is null, and encryptedData holds the answer. It is 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 is sent by every HTTP client: accept-encoding. A thousand order events are over a hundred kilobytes, as they are. Asked with br, the answer is several times smaller, with the same rows. With gzip, it is about the same. x-no-compression set to true turns it off for one call. And an answer under fifty kilobytes goes as it is. That limit is a setting of the server.

Rows of a stream are never compressed.

Every header

Here is every header on one page. Some say who calls. Some set the shape of the answer. Some set the cache, the encryption, and the language. And some say where the code runs.

Good to know

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

Built on standards

The client chooses the shape, and the server does the work. One way of doing it, for every API of every table. So a client written by an AI assistant just 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, when you ask. Next: custom APIs, the first steps. API Maker. Build faster, spend smarter, deliver better.