Globals
Index of every global available in scripts - fetch, console, sleep, toDateTime, ensureLatin and CryptoJS - with links to their reference pages.
A global is a name that is available in every script file, without an import. The platform provides a small, fixed set: one function to call external systems, a few helpers for text, dates, waiting and signing, and a console for logging. Capabilities that are not globals are modules: getSecret, the Secutix fetch and semantics (Apple Music).
List of globals
fetch(url, options?)
Sends an HTTP request and returns { StatusCode, ResponseText }. Supports authentication, caching and throttling.
console
Writes to the platform's log: log, debug, trace, table, info, warn, assert, error.
ensureLatin(value, replacement?)
Turns look-alike and accented characters into plain Latin letters.
CryptoJS.HmacSHA256(secret, value)
Computes an HMAC-SHA256 signature as uppercase hexadecimal text.
Other names that the editor shows in a handler, such as context in the default export, are parameters handed to the script and not globals. The standard JavaScript built-ins (JSON, Math, Date, Array, and so on) are available as usual.
Rules that apply to all globals
Globals that can be awaited (fetch, sleep) return promises, so handlers that use them are written with async and await. Globals keep no state between runs; reuse data with the Cache option of fetch (see How scripts run).
FAQ
Last updated

