# @vulcan-sql/extension-api-caller

> Calling APIs to get data from other sources

Latest version **0.10.4** (published 2024-01-18) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @vulcan-sql/extension-api-caller
pnpm add @vulcan-sql/extension-api-caller
yarn add @vulcan-sql/extension-api-caller
bun add @vulcan-sql/extension-api-caller
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.10.4 |
| Published | 2024-01-18 |
| First published | 2023-08-18 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 20 |
| Unpacked size | 8 KB |
| Known vulnerabilities | 0 (+25 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 792 |
| Maintainers | fredalai, shimin.wong, star.you, cannerbot, eason.kuo, wwwy3y3 |
| Keywords | vulcan, vulcan-sql, data, sql, database, data-warehouse, data-lake, api-builder, api |

## Links

- npm: https://www.npmjs.com/package/@vulcan-sql/extension-api-caller
- Repository: https://github.com/Canner/vulcan
- Homepage: https://github.com/Canner/vulcan#readme
- Issues: https://github.com/Canner/vulcan/issues
- npm.io page: https://npm.io/package/@vulcan-sql/extension-api-caller

## Dependencies (20)

- [ms](https://npm.io/package/ms.md) 3.0.0-canary.1
- [joi](https://npm.io/package/joi.md) ^17.6.0
- [koa](https://npm.io/package/koa.md) ^2.13.4
- [glob](https://npm.io/package/glob.md) ^8.0.1
- [uuid](https://npm.io/package/uuid.md) ^9.0.0
- [axios](https://npm.io/package/axios.md) ^0.27.2
- [dayjs](https://npm.io/package/dayjs.md) ^1.11.2
- [tslib](https://npm.io/package/tslib.md) ^2.3.0
- [tslog](https://npm.io/package/tslog.md) ^3.3.3
- [duckdb](https://npm.io/package/duckdb.md) 0.7.1
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [moment](https://npm.io/package/moment.md) ^2.29.4
- [js-yaml](https://npm.io/package/js-yaml.md) ^4.1.0
- [nunjucks](https://npm.io/package/nunjucks.md) ^3.2.3
- [inversify](https://npm.io/package/inversify.md) ^6.0.1
- [toad-scheduler](https://npm.io/package/toad-scheduler.md) ^2.2.0
- [class-validator](https://npm.io/package/class-validator.md) ^0.14.0
- [reflect-metadata](https://npm.io/package/reflect-metadata.md) ^0.1.13
- [class-transformer](https://npm.io/package/class-transformer.md) ^0.5.1
- [@vulcan-sql/test-utility](https://npm.io/package/@vulcan-sql/test-utility.md) 0.10.4

## Alternatives

- [@libsql/sqlite3](https://npm.io/package/@libsql/sqlite3.md) — 39.8K weekly downloads
- [@fortemi/core](https://npm.io/package/@fortemi/core.md) — 461 weekly downloads
- [cdb-converter](https://npm.io/package/cdb-converter.md) — 341 weekly downloads
- [@uplo/adapter-prisma](https://npm.io/package/@uplo/adapter-prisma.md) — 75 weekly downloads
- [typeorm-aios](https://npm.io/package/typeorm-aios.md) — 30 weekly downloads

## Recent versions

- 0.10.4 (latest) — 2024-01-18
- 0.10.4-dev.20240207.0 (dev) — 2024-02-07
- 0.10.4-beta.0 (beta) — 2024-01-18
- 0.10.4-dev.20240202.0 — 2024-02-02
- 0.10.4-dev.20240131.0 — 2024-01-31
- 0.10.4-dev.20240130.0 — 2024-01-30
- 0.10.4-dev.20240129.0 — 2024-01-29
- 0.10.4-dev.20240126.0 — 2024-01-26
- 0.10.4-dev.20240123.0 — 2024-01-23
- 0.10.4-dev.20240122.0 — 2024-01-22
- 0.10.3 — 2024-01-11
- 0.10.3-beta.0 — 2024-01-11
- 0.10.2 — 2023-10-24
- 0.10.2-beta.0 — 2023-10-24
- 0.10.1-dev.20231018.0 — 2023-10-18
- … 25 more at https://npm.io/package/@vulcan-sql/extension-api-caller/versions

## README

# extension-api-caller

Allow to call APIs from other sources for VulcanSQL, provided by [Canner](https://canner.io/).

## Installation

1. Install the package:

   ```bash
   npm i @vulcan-sql/extension-api-caller
   ```

2. Update your `vulcan.yaml` file to enable the extension:

   ```yaml
   extensions:
     api: '@vulcan-sql/extension-api-caller'
   ```

## Usage

To pass the path parameters:

```sql
{% set a_variable_you_can_define = { "path": { "id": 1 } } %}
SELECT {{ a_variable_you_can_define | rest_api(url='https://dummyjson.com/products/:id') }}
```

To pass the query parameters:

```sql
{% set a_variable_you_can_define = { "query": { "q": "phone" }  } %}
SELECT {{ a_variable_you_can_define | rest_api(url='https://dummyjson.com/products/search') }}
```

To issue the POST request:

```sql
{% set a_variable_you_can_define = { "body": { "title": "BMW Pencil" } } %}
SELECT {{ a_variable_you_can_define | rest_api(url='https://dummyjson.com/products/add', method='POST') }}
```

To pass the headers and multiple fields:

```sql
{% set a_variable_you_can_define = { "headers": { "Content-Type": "application/json" }, "body": { "title": "BMW Pencil" } } %}
SELECT {{ a_variable_you_can_define | rest_api(url='https://dummyjson.com/products/add', method='POST') }}
```

---
_Source: https://npm.io/package/@vulcan-sql/extension-api-caller · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
