Updates
This commit is contained in:
parent
6b684e0cc3
commit
55c832baff
76
pages/api-reference/index.mdx
Normal file
76
pages/api-reference/index.mdx
Normal file
@ -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).
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
## 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
|
||||||
|
```
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
## 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",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
```
|
Loading…
Reference in New Issue
Block a user