Manual · 7

The IllusionDB host API in scripts

Every script (custom endpoint, hook, or test run) can read and write tables via the global illusiondb object:

illusiondb.getRecord(tableId, pk)
illusiondb.query(tableId, { filter, limit, offset })
illusiondb.createRecord(tableId, values)
illusiondb.updateRecord(tableId, pk, values)
illusiondb.deleteRecord(tableId, pk)

In addition, log(...) prints a line to the server console (prefixed with the script name) – handy for debugging.

Note: write access through this API doesn’t go through the same field-type-specific value conversion as a real HTTP request (e.g. date normalization) – values should therefore already be passed in the raw format the respective field type expects.