@vulcan-sql/extension-api-caller
TypeScript icon, indicating that this package has built-in type declarations

0.10.4 • Public • Published

extension-api-caller

Allow to call APIs from other sources for VulcanSQL, provided by Canner.

Installation

  1. Install the package:

    npm i @vulcan-sql/extension-api-caller
  2. Update your vulcan.yaml file to enable the extension:

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

Usage

To pass the path parameters:

{% 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:

{% 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:

{% 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:

{% 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') }}

Package Sidebar

Install

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

Weekly Downloads

14

Version

0.10.4

License

Apache-2.0

Unpacked Size

8.23 kB

Total Files

11

Last publish

Collaborators

  • fredalai
  • shimin.wong
  • cannerbot
  • wwwy3y3