Features/REST API

API response as global variable

Load a REST API response on every page load and use it anywhere on the site as a variable.

A REST request with Source enabled can also get a Variable name. On every site load the request runs (using its cache) and the result is stored under that name. You can then read it in any text, attribute or condition, without binding a source to an element.

How it works

  • Variable name: lowercase a-z, 0-9 and dots only, max 70 chars.
  • Read it as $rest->get('<variable>').
  • Runs with the request's default Properties and its cache setting.

When to use it

  • Show a site-wide announcement from an API
  • Load settings or exchange rates once and use them on many pages

Limitations

  • Runs on every site load; without cache this adds the API latency to page loads
  • Only GET-style usage makes sense; the request runs regardless of method

Availability

  • Works in Designer.
  • Included in every plan.
  • Limits: Variable name 70 chars, a-z0-9 and dots

How to use it.

  1. Enable Source on the request
  2. Enter a Variable name
  3. Set a Cache duration
  4. Use the variable in the builder

Questions.

How do I reference it?

Related features.

No card needed

Build it today.Pay when it goes live.

Every feature is unmetered while you build. Checkout opens the first time you publish.