API Maker

The backend engine for the AI era

Chapters

What you will learn

  • Sign in, and what a new account holds
  • The default secret: a connection string and the password of the API user
  • A token from the token API, as an app gets it
  • The first write, and what the schema does on a save
  • Read back with deep populate, and a refusal with four errors
  • The rest of the sample: custom APIs and utility classes to learn from
In the docsYour first API in 10 minutes
Transcript836 words · click a time to play from there

Intro

Your first API in ten minutes. A new account comes with a sample shop : point it at a MongoDB, get a token, then save, read and break your first rows, with every check of a real backend.

A first API, the usual way

A first API usually means a framework to pick and a project to scaffold, an ORM and a database driver, validation code for every field, a token library, and a server to deploy, before the first row is saved. With API Maker, a new account has its APIs already, a connection string and a password are the setup, and every check comes from the schema. In this video : the sign in, the sample of a new account, a connection string, a token, a category and a product, a read back, a refusal, and the rest of the sample.

Before you start

First, API Maker has to run : on your computer with API Maker Launchpad, in video fifty five, or on a server with one command, in video sixty one. Both print the address of the admin panel and how to sign in. At Calm Home, Sara Lindqvist, a backend engineer, gets an account of her own : the root user made it for her.

Sign in

The admin panel opens on its login card. Sara types her email, her password, and the letters of the captcha. Sign in : her dashboard, with the same four panels as every account.

The sample

A new account is not empty. It has an instance named mongodb, and a database shop with the schemas of five tables : categories, customers, products, orders and their items. Custom APIs to learn from, hooks, an event, a migration script and a utility class. One thing is missing : a MongoDB for the instance.

Step one: the secret

Security, Secret Management, and the secret named Default. Two values to set. The API user default has no password yet : give it one. And the connection string of the sample instance : Sara's MongoDB, with a login of her own. Save. The secret stays on this server : it never goes to git. Instance API, the instance mongodb : no database yet. MongoDB makes one at the first write.

Edit, and Test Instance : the connection works. Nothing else to change.

Step two: a token

Now, as an app calls it. Every call needs a token. The token API takes the API user and its password, and answers a token, a refresh token, and how long the token lives : three days. An app sends it in the header x-am-authorization.

Step three: the first write

The first write : a category, through the schema API of its table. The address names the account, sara, then the instance, the database and the table. Two hundred and one : saved. API Maker made its id, and the schema made its slug from the name. And MongoDB made the database shop with it.

A product

In the panel, API Testing signs every call for you. mongodb, shop, there now, products, Save single or multiple. A product : a name with spaces around it, a currency in small letters, a price in cents, and its category, by the id of the first write. Send : two hundred and one. The name is trimmed, the currency in capitals, status and is active got their defaults, and the dates.

A product number from its counter, a public id, and a slug. All of it from the schema, without code.

Read it back

Now read it back : Get all. In the query params, select four fields, and deep, with only the name of the field, category : the schema knows where it points. Send : the product, with its category inside it, read in the same call.

A refusal

And a refusal. A product with a name of one letter, a currency the schema does not list, a price below zero, and a discount. Send : four hundred, and all four problems in one answer, each with its field. The last one is the message of a validator function in the schema : a discount needs an approver. Nothing was saved.

The rest of the sample

The sample has more to read. Custom API : the examples under default, each a feature with comments : deep populate, find and join, caching, an upload, a sign in. Most are No Access : only code of the account calls them. And under APIs and Logic, Utility Classes : DefaultUtils, helpers every piece of code can require.

Where next

Where next? Connect your own databases, in video two. Write a custom API of your own, in video fourteen. Replace the default API user and group with small ones, in video twenty four, and let the security report check the account, in video twenty seven.

Recap

To sum up. A new account comes with a sample shop. A connection string and a password, in the secret. A token, from the token API. Rows saved and checked by their schema, read back with their relations, and every error in one answer. Next : call your APIs from a web or a mobile app. API Maker. Build faster, spend smarter, deliver better.