API Reference

Access data from external sources. Datasquirel is platform-agnostic so all you need is a HTTP request with the right credentials. Our NPM module abstracts this aspect for ease of use when using node.

Overview

All data stored in your databases and media can be accessed through our integrated API. There are two sets of API keys, each with different scope. If you want to just fetch data use the Read Only API key. If you want to have full access to every aspect of your account, use the Full Access API key. Learn how to add API keys here.


Getting started

After you have your API keys, you can start making calls using our API integration. We have an NPM module for node projects, but you only need a HTTPS client to make the calls.

npm install @moduletrace/datasquirel

API Options

Datasquirel API exposes three options, crud, media, and sql.

Crud

The crud option allows you to perform CRUD operations on your databases. Learn more here.

import datasquirel from "@moduletrace/datasquirel";

const crud = await datasquirel.api.crud({
    database: "social_network",
    table: "users",
    key: process.env.READ_ONLY_API_KEY,
    params: {
        action: "get",
        query: {
            limit: 10,
        },
    },
});

Media

The media option allows you to access your media files. Learn more here.

import datasquirel from "@moduletrace/datasquirel";

const media = await datasquirel.api.media({
    key: process.env.READ_ONLY_API_KEY,
    params: {
        mediaName: "test.jpg$",
    },
});

SQL

The sql option allows you to execute SQL queries on your databases. Learn more here.

import datasquirel from "@moduletrace/datasquirel";

const sql = await datasquirel.api.sql({
    key: process.env.READ_ONLY_API_KEY,
    params: {
        query: "SELECT * FROM users",
    },
});