Custom API settings¶
The Basic Info tab of a custom API is a TypeScript object : where the API answers, who may call it, and how it behaves. It is always TypeScript, whatever language the code of the API is written in, and API Maker runs it itself when you save : the tab shows TypeScript with a lock.
| Page | APIs & Logic → Custom API → the API → Basic Info. |
| Type | T.ICustomApiSettingsTypes |
| URL | /api/custom-api/<user path><path> with requestMethod. Path and method together are unique. |
The keys¶
| Key | Meaning |
|---|---|
name |
Unique name, also the folder of the API in Git. |
path, requestMethod |
Where it answers : GET, POST, PUT or DELETE. /customers/:id gives g.req.params.id. |
apiAccessType |
TOKEN_ACCESS (default), IS_PUBLIC, or NO_ACCESS for an API only your code calls. |
authProviders |
The person tokens the call must carry. Absent : common.authProviders of the secret ; [] : the API user token alone. |
enableCaching |
Cache the answer in Redis per body, query and person. |
resetCacheOnModificationOf |
DB:instance:database:table, CA:custom API name : what drops the cached answers. Otherwise reset custom API cache. |
acceptOnlyEncryptedData |
Refuse plain payloads : encrypted payloads. |
reqBodySchema, reqQueryParametersSchema |
A schema for the body and the query : validated and converted before the code runs, checkable with is valid data for custom API. |
customApiTimeoutInSeconds |
How long the code of the API and the hooks of its versions may run, in seconds, in the sandbox and with runOnNativeProcess alike. Empty : sandboxReqTimeout (13 seconds). A request which sends x-am-sandbox-timeout is given that time instead : time of a run. |
runOnNativeProcess |
Run on the process of API Maker instead of the sandbox : faster, less isolated ; console.log is not captured, use g.logger. |
errorList |
The messages this API throws, listed for internationalization. |
fileUpload |
enable, allowFileUploadFields (files…), and per field validations : minFileSizeBytes, maxFileSizeBytes, allowedExtensionsArr. See files. |
swaggerDocs |
tag, summary, description, parameters for the Swagger docs of the API users. |
separateSandboxSettings |
Sandboxes of their own for this API : see below. |
The language of the code of the API is chosen in the title bar of its editor, not here : see languages.
Separate sandbox¶
By default the code of a custom API runs in the sandboxes of its language, with the packages of the Sandbox Settings. An API which needs other packages, another runtime or version, or which must not share its sandboxes with the rest, names a group : every API of the account which names the same group shares its sandboxes, and no other code runs there.
| Key | Meaning |
|---|---|
enableSeparateSandboxForThis |
The name of the group. Empty : the sandboxes of the language. |
runtime, version |
A runtime of the language of the code (node or bun for TypeScript) and a tag of its image. The ones of the Sandbox Settings when absent. |
sandboxCount |
The most sandboxes of the group at a time, on each server. |
packages.sandboxPackages |
The packages of the group, from the registry of its language. |
packages.allowAllPackagesOfAdmin |
true : the packages of the Sandbox Settings too. A package named in both is installed once, in the version of the group. |
dockerFileOfSandbox |
A Dockerfile of the group, with the same markers. |
- The group gets an image of its own (shared with any account which has the same settings), built when the API is saved.
- Changing the settings of a group starts its sandboxes anew on every server.