1 line
8.7 KiB
JSON
1 line
8.7 KiB
JSON
{"pageProps":{"user":null,"pages":[{"id":8,"title":"Getting Started","slug":"getting-started","level":1,"parent_id":null},{"id":9,"title":"Getting Started","slug":"getting-started","level":2,"parent_id":3},{"id":2,"title":"Quick Start","slug":"quick-start","level":1,"parent_id":null},{"id":3,"title":"GUI Reference","slug":"gui-reference","level":1,"parent_id":null},{"id":4,"title":"API Reference","slug":"api-reference","level":1,"parent_id":null},{"id":10,"title":"Get","slug":"get","level":2,"parent_id":4},{"id":12,"title":"Database Reference","slug":"database-reference","level":1,"parent_id":null},{"id":11,"title":"Post","slug":"post","level":2,"parent_id":4},{"id":13,"title":"Data types","slug":"data-types","level":2,"parent_id":12},{"id":14,"title":"Querying Data","slug":"querying-data","level":2,"parent_id":12},{"id":15,"title":"Upload Media","slug":"upload-media","level":2,"parent_id":3}],"targetPage":{"title":"Quick Start","slug":"quick-start","description":"<p>Start saving and retrieving data now. Set up and start deploying in minutes.</p>","content":"<h2>Starting up your Datasquirel instance</h2><p>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:</p><h3>1. Create Account</h3><p>Create a free account <a href=\"https://datasquirel.com/create-account\">here</a></p><p><img src=\"https://static.datasquirel.com/images/user-images/user-2/docs/create-account.png\" width=\"800\" height=\"578\" /></p><p><br /></p><h3>2. Create Database</h3><p>Navigate to your <a href=\"https://datasquirel.com/admin\">Dashboard</a> or <a href=\"https://datasquirel.com/admin/databases\">Databases page</a>. Click the \"Add Database\" button to add a new database.</p><p><img src=\"https://static.datasquirel.com/images/user-images/user-2/docs/screencapture-localhost-7070-admin-2023-07-16-13_35_04.png\" width=\"800\" height=\"424\" /></p><p>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</p><p><img src=\"https://static.datasquirel.com/images/user-images/user-2/docs/screencapture-localhost-7070-admin-databases-add-database-2023-07-17-11_01_28.png\" width=\"800\" height=\"374\" /></p><p>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.</p><p><img src=\"https://static.datasquirel.com/images/user-images/user-2/docs/screencapture-localhost-7070-admin-databases-test-2023-07-17-11_09_52.png\" width=\"800\" height=\"374\" /></p><h3>3. Add a table</h3><p>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.</p><p><img src=\"https://static.datasquirel.com/images/user-images/user-2/docs/add-table-form.png\" width=\"800\" height=\"797\" /></p><p>On each table form you have access to the table fields(or column titles). Each field contains a few options:</p><ul><li><strong>Field Name</strong>: Name of field(or column title)</li><li><strong>Data Type</strong>: type of data to be stored on that field: <a class=\"inline\" href=\"docs/db-reference/data-types\">See All Datatypes</a></li><li><strong>Required</strong>: Choose whether the field must have a value or not</li><li><strong>Default Value</strong>: Default value of field in the case no value is entered.</li><li><strong>More:</strong> The \"More\" button contains options for encryption and foreign keys</li></ul><p>After these fields are filled, click \"Add Field\". Add as much field as you need. These fields serve as column titles for your table.</p><p><img src=\"https://static.datasquirel.com/images/user-images/user-2/docs/tables-list.png\" width=\"800\" height=\"374\" /></p><p>After creating a table you now have access to the tables list.</p><p><br /></p><h3>4. Add an Entry</h3><p>Select the newly created Table and on the designated table page click on \"Add New Table Entry\"</p><p><img src=\"https://static.datasquirel.com/images/user-images/user-2/docs/table-page.png\" width=\"800\" height=\"576\" /></p><p>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.</p><p><img src=\"https://static.datasquirel.com/images/user-images/user-2/docs/add-entry.png\" width=\"800\" height=\"633\" /></p><p><br /></p><h2>Fetching Data</h2><p>to start fetching data from your datasquirel account, you need to go through 3 steps:</p><h3>1. Create an API key</h3><p>Your api key is your gateway to all your data. There are two sets of API keys available for use: <strong>Read Only </strong>API keys, and <strong>Full Access </strong>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.</p><p>To create an API key, follow these steps:</p><ul><li>Login to your admin dashboard and navigate to \"API keys\" page<br /><br /><img src=\"https://static.datasquirel.com/images/user-images/user-2/docs/api-keys-page.png\" width=\"700\" height=\"327\" /></li><li>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).<br /><br /><img src=\"https://static.datasquirel.com/images/user-images/user-2/docs/add-api-key-dialogue.png\" width=\"700\" height=\"327\" /></li><li>Once your API key is created, copy the API key by clicking \"Copy API key\". Keep this key safe and secured.<br /><br /><img src=\"https://static.datasquirel.com/images/user-images/user-2/docs/api-keys-list.png\" width=\"700\" height=\"327\" /></li></ul><h3><br /></h3><h3>2. Use your API key to make a request</h3><p>After creating your API key, then comes the backend section.</p><ul><li>First add the datasquirel package via NPM<br /><br /><pre class=\"language-markup\">npm install datasquirel</pre></li><li>Next import the datasquirel module into your project, choose the database you will be querying, add your API key, and then run the query.<br /><br /><pre class=\"language-javascript\"><span class=\"token keyword\">const</span> datasquirel <span class=\"token operator\">=</span> <span class=\"token function\">require</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"datasquirel\"</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n\ndatasquirel\n <span class=\"token punctuation\">.</span><span class=\"token function\">get</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">{</span>\n <span class=\"token literal-property property\">db</span><span class=\"token operator\">:</span> <span class=\"token string\">\"test\"</span><span class=\"token punctuation\">,</span>\n <span class=\"token literal-property property\">key</span><span class=\"token operator\">:</span> process<span class=\"token punctuation\">.</span>env<span class=\"token punctuation\">.</span><span class=\"token constant\">DATASQUIREL_READ_ONLY_KEY</span><span class=\"token punctuation\">,</span>\n <span class=\"token literal-property property\">query</span><span class=\"token operator\">:</span> <span class=\"token string\">\"SELECT title, slug, body FROM blog_posts\"</span><span class=\"token punctuation\">,</span>\n <span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span>\n <span class=\"token punctuation\">.</span><span class=\"token function\">then</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">response</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">{</span>\n console<span class=\"token punctuation\">.</span><span class=\"token function\">log</span><span class=\"token punctuation\">(</span>response<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n <span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></pre></li></ul><p>Read our <a href=\"../../../docs/api-reference\">API Reference</a> for more.</p>"}},"__N_SSG":true} |