Quick Start
Start saving and retrieving data now. Set up and start deploying in minutes.
Starting up your Datasquirel instance
To get started with datasquirel you need an account online. The datasquirel npm module will hit this account via out API integration using your API credentials. Without an account, you cannout query any data on our API. Follow these steps to create an account:
1. Create Account
Create a free account here
2. Create Database
Navigate to your Dashboard or Databases page. Click the "Add Database" button to add a new database.
On the next screen that appears, fill in the form and add a database image if you wish. Click on "Create Database" to add the new database
Creating a new database takes you to the database page. This page allows you to import a pre-existing database using an SQL export file, or create a new table inside the newly-formed database. More operations for your database can be found in the database dropdown on the top left, or the "more" dropdown on the top right.
3. Add a table
Databases consists of Tables: each with fields(or columns) and entries(or rows). Select a database from your database list to access the single database pages. Click on "Add Table" and fill in the new table form.
On each table form you have access to the table fields(or column titles). Each field contains a few options:
- Field Name: Name of field(or column title)
- Data Type: type of data to be stored on that field: See All Datatypes
- Required: Choose whether the field must have a value or not
- Default Value: Default value of field in the case no value is entered.
- More: The "More" button contains options for encryption and foreign keys
After these fields are filled, click "Add Field". Add as much field as you need. These fields serve as column titles for your table.
After creating a table you now have access to the tables list.
4. Add an Entry
Select the newly created Table and on the designated table page click on "Add New Table Entry"
Fill in the required fields and click on "Add Entry". Congrats, you have now created your first datasquirel data entry, you can now access this data from any platform using your api key.
Fetching Data
to start fetching data from your datasquirel account, you need to go through 3 steps:
1. Create an API key
Your api key is your gateway to all your data. There are two sets of API keys available for use: Read Only API keys, and Full Access API keys. They function as their names sound: Read only API keys only read data, Full Access API keys can read, write, delete, update, and also add media to your media storage directory.
To create an API key, follow these steps:
- Login to your admin dashboard and navigate to "API keys" page
- Click on "Add API key" and fill in the form. Give your API key a name and select which the scope you wich to cover with the key ("Read Only" for just reading data, "Full Access" for reading and writing data).
- Once your API key is created, copy the API key by clicking "Copy API key". Keep this key safe and secured.
2. Use your API key to make a request
After creating your API key, then comes the backend section.
- First add the datasquirel package via NPM
npm install datasquirel
- Next import the datasquirel module into your project, choose the database you will be querying, add your API key, and then run the query.
const datasquirel = require("datasquirel"); datasquirel .get({ db: "test", key: process.env.DATASQUIREL_READ_ONLY_KEY, query: "SELECT title, slug, body FROM blog_posts", }) .then((response) => { console.log(response); });
Read our API Reference for more.