Skip to content

REST API Data Sources

REST API data sources let you define a named connection to an external HTTP API. Optionally provide an OpenAPI spec for endpoint auto-discovery and IntelliSense in the script editor.

Creating an API data source

  1. Go to Data SourcesNew Data Source
  2. Select REST API
  3. Fill in:
    • Name — used to reference this data source in scripts (e.g. ShopifyAPI)
    • Base URL — the root URL of the API (e.g. https://api.shopify.com/v1)
    • Auth — see Auth & Credentials
    • OpenAPI Spec (optional) — paste a JSON or YAML OpenAPI spec for endpoint discovery
  4. Click Test Connection — makes a HEAD or GET request to the base URL
  5. Save

Using in scripts

If you provided an OpenAPI spec, endpoints are available as methods on the datasource object:

JavaScript / TypeScript:

javascript
// Auto-generated from OpenAPI spec
const products = await datasources.ShopifyAPI.getProducts({ limit: 50 })
logger.info(`Products: ${products.length}`)

PowerShell:

powershell
$products = $datasources.ShopifyAPI.GetProducts(@{ limit = 50 })
$logger.Info("Products: $($products.Count)")

Without an OpenAPI spec, use fetch / Invoke-RestMethod directly with authHeaders for auth.

IntelliSense

When an OpenAPI spec is present, the Monaco editor shows autocomplete for endpoint names and parameter types as you type datasources.YourApiName..