From 55c832baff3b5aa7d9eaf8dce98140db48bfaf48 Mon Sep 17 00:00:00 2001 From: Benjamin Toby Date: Wed, 16 Jul 2025 19:46:22 +0100 Subject: [PATCH] Updates --- pages/api-reference/index.mdx | 76 +++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 pages/api-reference/index.mdx diff --git a/pages/api-reference/index.mdx b/pages/api-reference/index.mdx new file mode 100644 index 0000000..19490bc --- /dev/null +++ b/pages/api-reference/index.mdx @@ -0,0 +1,76 @@ +--- +title: API Reference | Datasquirel docs +description: Datasquirel API Documentation +page_title: Create Table Fields +page_description: 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](/docs/quick-start). + +
+ +## 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. + +```bash +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](/docs/api-reference/crud). + +```javascript +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](/docs/api-reference/media). + +```javascript +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](/docs/api-reference/sql). + +```javascript +import datasquirel from "@moduletrace/datasquirel"; + +const sql = await datasquirel.api.sql({ + key: process.env.READ_ONLY_API_KEY, + params: { + query: "SELECT * FROM users", + }, +}); +```