Initialization¶
The seatable-html-page-sdk is the bridge between an HTML Page and its Universal App. It exposes APIs for data interaction and event subscription. This page covers installation and initialization. For data operations, see Rows and Files & Images.
Installation¶
Install with npm or yarn — recommended for the modular development style.
Load the SDK via CDN — convenient for the non-modular style, where everything lives in index.html. HTMLPageSDK becomes available as a global.
<!-- unpkg -->
<script src="https://unpkg.com/seatable-html-page-sdk@latest/dist/index.min.js"></script>
<!-- or jsDelivr -->
<!-- <script src="https://cdn.jsdelivr.net/npm/seatable-html-page-sdk@latest/dist/index.min.js"></script> -->
<script>
const sdk = new HTMLPageSDK();
</script>
Pin a version
@latest always resolves to the newest release. For production pages, pin an explicit version (for example seatable-html-page-sdk@1.0.0) so a new release cannot change behavior unexpectedly.
Initialize the SDK¶
Create an instance, then call init() before making any data calls. Write the initialization once — the same code works in both development and production:
const options = window.__HTML_PAGE_DEV_CONFIG__ || null;
const sdk = new HTMLPageSDK(options);
await sdk.init();
How options is resolved differs by environment, but your code does not change:
Inside the Universal App, window.__HTML_PAGE_DEV_CONFIG__ is not defined, so options is null. The SDK derives the connection context from the host app automatically — no credentials in your code.
There is no host app locally, so the SDK needs connection details. You do not hardcode them: the Vite dev server reads src/setting.js and injects the values into window.__HTML_PAGE_DEV_CONFIG__ at serve time.
The injected object has this shape:
{
server: "your-html-page-server",
accountToken: "your-account-token",
appUuid: "your-app-uuid",
pageId: "your-app-page-id",
}
Because setting.js is git-ignored and never bundled, your account token stays out of the build.
Basic usage¶
Once initialized, call the data APIs on the instance:
const sdk = new HTMLPageSDK(options);
await sdk.init();
const res = await sdk.listRows({
tableName: "Employees",
start: 0,
limit: 100,
});
const rows = res.data.results;
All SDK methods are asynchronous and return promises — always await them. Row methods resolve to the HTTP response, so the payload is under .data (see Rows). Upload methods are the exception and return the result object directly (see Files & Images).
Next steps¶
- Rows — list, add, update and delete rows, including batch operations.
- Files & Images — upload files and images for file and image columns.