Execute Site24x7 API calls
site24x7_executeExecute custom JavaScript to call Site24x7 API, manage monitors, accounts, and tenancy across customers.
Instructions
Run Site24x7 API calls by writing JavaScript that uses the site24x7 namespace.
Surface:
site24x7.<tag>.<operationId>(args)— typed call. Args are auto-routed: keys matching path or query params from the spec are placed correctly; remaining keys form the JSON body for POST/PUT/PATCH. Override with{ pathParams: {...}, query: {...}, body: {...}, version: '2.1', zaaid: '...' }.site24x7.callOperation(operationId, args)— flat lookup by id.site24x7.request({ method, path, query?, body?, version?, zaaid? })— raw HTTP escape hatch (e.g. for endpoints not yet in the spec).site24x7.spec—{ title, sourceUrl, generatedAt, operationCount }for diagnostics.site24x7.listCustomers()— MSP/BU customer enumeration (uses /api/short/msp/customers or /api/short/bu/business_units based on accountType).site24x7.withCustomer(zaaid, async fn)— runfn(site24x7)with the closure scoped to a customer. Restores the previous zaaid on exit, even on throw. Must be awaited.site24x7.zaaid— the currently active zaaid (orundefined).
Operations are async — use await. Top-level await is not supported; wrap in an async IIFE:
(async () => {
const status = await site24x7.request({ method: 'GET', path: '/api/current_status' });
return status;
})()MSP recipe (fan out over customers)
(async () => {
const customers = await site24x7.listCustomers();
const out = [];
for (const c of customers) {
const status = await site24x7.withCustomer(c.zaaid, async (s) => {
return s.request({ method: 'GET', path: '/api/current_status' });
});
out.push({ name: c.name, zaaid: c.zaaid, down: status?.monitors_status?.down ?? 0 });
}
return out;
})()Errors
Errors are prefixed with a structured tag:
[site24x7.HttpError] HTTP 403 GET /api/users (operation requires scope(s) \Site24x7.Admin.Read` — confirm your refresh token grants them)`[site24x7.MissingZaaidError] operation "..." requires a zaaid in scope (operation mspOnly=true). Hint: call site24x7.listCustomers() and wrap the call in site24x7.withCustomer(zaaid, ...).[site24x7.MissingCredentialsError] ...when no Zoho OAuth credentials are configured[site24x7.UnknownOperationError] ...when the operationId doesn't exist in the spec
Limits
Per-execute API call ceiling (default 50, configurable via
SITE24X7_MAX_CALLS_PER_EXECUTE).Sandbox memory + 30 s deadline.
Credentials never enter the sandbox.
Site24x7 enforces its own per-token rate limit (~10 req/s on most plans). 429 triggers one polite retry.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | JavaScript code to execute against the live Site24x7 API. Wrap async work in an IIFE. |