Step 1: A fast and simple way to start creating an API around your data
How do you use your internal data stored in MySQL or MariaDB to host an API.
Companies create tons of data and sometimes you might be thinking “can I strike gold with my own data?” At a certain moment it makes sense to see which companies could use your data (free or paid) for their business.
It is not the obvious first thought but maybe you have a goldmine in your hands. Most companies do their own thing and that means they re-create what others already have. The main reason is being scared of competition and what others can do with your data.
In this API era it is pretty easy to offer some data to your customers or partners and create an interesting B2B side hustle. However, you need some technology in place.
A technology stack that is easy and powerful
We have tested and used the same stack over and over again: Easypanel + Budibase + N8N and MariaDB.
It’s easy to use, flexible and powerful enough to run on a daily basis. In short, the purpose of above tools are:
N8N for workflow automation;
Budibase for CRUD interfaces, automation and data management;
MariaDB for storage;
Easypanel for server and docker management.
N8N
Budibase
Easypanel
The workflow for API authentication
The main goal in this first step is to make sure that people accessing your future API are authenticated. As you know most API’s have some authentication. You don’t want people messing around in your data.
We have combined N8N and MariaDB to make a basic authentication process. It’s simple and follows the next steps:
Run a webhook
Extract the header with API key
Check the key in your database
Send a response
Run we webhook
This will be triggered through an URL. It will support both GET and POST methods.
Extract the header with API key
This will look for a header that was sent by using Postman, the header is x-apikey.
We will store the apikey in the variable apikey.
Check the key in your database
For this we made a table with one field, apikey.
With the MYSQL node we can get to the stored key and check if it exists.
Send a response
Our earlier defined webhook expects a response node. In that response node we can send back several types of responses. We just send a plain text back.
What have you learned?
You have learned to use N8N to create a first step for offering your data to the public.
Whe can help to kickstart this for you, check below button.