Skip to content

Data Sources Overview

Data Sources are named connections to external systems — databases or REST APIs — whose credentials are encrypted and stored by ApiMeld. Scripts access them through injected variables without ever seeing raw passwords or tokens.

Why data sources?

Without data sources, you'd have to hardcode credentials in each script. That's:

  • A security risk (credentials visible in script history and logs)
  • A maintenance headache (update one password → edit every script)

With data sources, credentials are stored once (AES-256-GCM encrypted), and injected at runtime into each script execution.

Supported connection types

TypeDescription
PostgreSQLDirect database connection
SQL ServerDirect database connection
MySQL / MariaDBDirect database connection
OracleDirect database connection
REST APIHTTP-based API with optional OpenAPI spec
Network ShareSMB/UNC file share — read, write, move, and delete files
SFTPSSH file transfer — upload, download, and manage remote files

Creating a data source

  1. Go to Data Sources in the sidebar
  2. Click New Data Source
  3. Choose a type and give it a name (this is what scripts use to reference it)
  4. Enter connection details — host, port, database name, credentials
  5. For REST APIs: optionally paste an OpenAPI spec for endpoint auto-discovery and IntelliSense
  6. Click Test Connection to verify
  7. Save

Using data sources in scripts

Data sources are injected into scripts as a named object. The name is the one you gave the data source when creating it.

PowerShell:

powershell
# Query a database
$rows = $datasources.MyDatabase.Query("SELECT * FROM orders WHERE status = 'pending'")
$logger.Info("Pending orders: $($rows.Count)")

# Call a REST API endpoint
$users = $datasources.MyApi.GetUsers()

JavaScript / TypeScript:

javascript
// Query a database
const rows = await datasources.MyDatabase.query('SELECT * FROM orders WHERE status = $1', ['pending'])
logger.info(`Pending orders: ${rows.length}`)

// Call a REST API endpoint
const users = await datasources.MyApi.getUsers()

Sharing data sources

Data sources can be shared with other users (view-only or with credentials included). Go to a data source and click Share to manage access.

When sharing without credentials, the recipient can use the data source in scripts but cannot see or export the connection credentials.

See also

ApiMeld Task Scheduler