Creator Backend for config sheets and file lifecycle methods
Backend config & files

Appifio Creator · Lesson AM03 · API REFERENCE §2 · 15 methods

Config sheets & file lifecycle
full methods - params · returns · notes

Whole-file JSON sheets (settings), create/delete/restore, rename, find files, and read/write single fields in storage.

Learning goals: Look up all 15 §2 methods; know flat ≠ indexed ledger (AM02).

Do not: use readFile/writeFile on login.json - use AM06. Do not deleteFile a whole ledger to remove one row - use updateData(..., null) (AM02).

Quick outline: A read/write sheets · B create/delete/rename · C check/search · D fields

A. Read / write config sheets

Backend storage panel with secrets manager and window.appifio SDK note
Storage + SDK
appifio_readFile(fileName) - flat (no id) · Public

What it does: Read an entire JSON config sheet.

Parameters: fileName - e.g. shop-settings.json, cms-settings.json.

const res = await appifio_client.appifio_readFile('cms-settings.json');
let settings = res.data?.content; // object or ""

Returns: { data: { content: object } } or content: "" if the sheet does not exist yet.

Note: Same function name as AM02 but without id. With id = one ledger row. JSON is already parsed - do not JSON.parse again.

appifio_writeFile(fileName, content, fileType?) · Admin+

What it does: Overwrite the whole sheet (or create an indexed master when needed).

Parameters: content = JSON string (usually JSON.stringify(obj)). fileType: 'flat' (default) | 'indexed' (create a ledger for append).

await appifio_client.appifio_writeFile(
  'config.json',
  JSON.stringify({ shopName: 'Lan Shop', phone: '090...' })
);

Returns: { success: true }

Note: Do not use this to write individual list rows. System files have their own policy (login.json is rejected). First append often auto-creates the ledger - indexed is not always required.

B. Create · delete · restore · rename · copy

appifio_createFile(fileName, content?) · Admin+

What it does: Create a new file. Parameters: content string, default ''.

await appifio_client.appifio_createFile('config.json', '{}');

Returns: { success: true } - errors if the name already exists (unlike writeFile, which overwrites).

appifio_deleteFile(fileName) · Admin+ (role user blocked)
await appifio_client.appifio_deleteFile('old-config.json');

Returns: { success: true } - soft delete (can restore). To remove one list row → AM02 updateData(..., null), not delete the whole master.

appifio_restoreFile(fileName) · Admin+
await appifio_client.appifio_restoreFile('old-config.json');

Returns: { success: true } - restores a soft-deleted file.

appifio_hardDeleteFile(fileName) · Super admin only
await appifio_client.appifio_hardDeleteFile('spam.json');

Returns: { success: true }. Note: Permanent delete (including indexed shards) - not undoable.

appifio_renameFile(oldName, newName) · Admin+

Parameters: Keep the same extension (e.g. both .json).

await appifio_client.appifio_renameFile('a.json', 'b.json');

Returns: { success: true }

appifio_copyFile(sourceFile, destFile) · Admin+
await appifio_client.appifio_copyFile('blog.json', 'blog-backup.json');

Returns: { success: true } - for indexed ledgers, shards are copied too.

C. Check · info · list · search

appifio_fileExists(fileName) · Public
const r = await appifio_client.appifio_fileExists('config.json');
// r.data.exists === true | false

Returns: { success: true, data: { exists: true|false } }. Sensitive system files may always report false (no leak).

appifio_getFileInfo(fileName) · Public
const r = await appifio_client.appifio_getFileInfo('config.json');
// data: file_name, file_type, file_size, is_deleted, created_at, updated_at

Note: Missing file → success: false (unlike readFile, which can return empty). Prefer fileExists / readFile in most flows.

appifio_listFiles(includeDeleted?) · Public
const r = await appifio_client.appifio_listFiles();
// r.data.files = [{ file_name, file_type, file_size, ... }]
await appifio_client.appifio_listFiles(true); // include soft-deleted - requires login

Note: Hides system files and internal shards. includeDeleted: true only works when an admin is logged in.

appifio_searchFiles(pattern) · Public

Parameters: wildcards *, ? - e.g. blog-*.json.

const r = await appifio_client.appifio_searchFiles('blog-*.json');
// r.data.files = [...]
appifio_findByName(fileName) · Public
const r = await appifio_client.appifio_findByName('config.json');
// r.data.files - exact name match

D. Read / write one field (dot path)

appifio_readField(fileName, fieldPath) · Public

Parameters: fieldPath with dots - e.g. display_formats.date, timezone.

const r = await appifio_client.appifio_readField('cms-settings.json', 'timezone');
// r.data.value - any | null (missing file/field → null)
appifio_writeField(fileName, fieldPath, value) · Admin+
await appifio_client.appifio_writeField('config.json', 'theme.color', '#ff0000');

Returns: { success: true }. Creates a flat sheet if missing. If value is an object, the system serializes it to JSON for you.

§2 checklist: readFile flat · writeFile · createFile · deleteFile · restoreFile · hardDeleteFile · renameFile · copyFile · fileExists · getFileInfo · listFiles · searchFiles · findByName · readField · writeField = 15/15

AM04 - Site files & upload (§3 - 7 methods)

Appifio Creator · Method series · AM03