How to connect Baserow to external tools with the API

Connect Baserow API image

Baserow has become the go-to solution for managing and organizing data, thanks to its robust database capabilities. With the right knowledge, you can take your data management game to a whole new level by syncing it with external tools.

Imagine this: all your data and processes are stored in Baserow, but you want to extend their functionality by integrating with other tools like CRMs, email marketing platforms, or analytics services. This is where Baserow’s API comes in handy. It effortlessly bridges the gap and streamlines your operations.

Why connect Baserow to external tools? The answer is simple: it opens up a world of possibilities. By automating tasks, enhancing data analysis, and making your workflow more efficient, you unlock the full potential of your data management.

What we’ll do

In this tutorial, you’ll learn how to harness the power of Baserow’s API to create custom automation. We’ll cover the following:

Prerequisites

You’ll need the following:

Let’s explore how you can easily connect to the tools and services you use regularly.

Connect your Baserow database via API

1. Set up your Baserow database

Log in to your existing Baserow account or create a new account if you don’t have one already.

Once you log in, you can access the dashboard to add workspaces and databases. You can work with an existing workspace, database, or table, or set up a new workspace from scratch.

In this tutorial, we will set up a new workspace and add a database to the workspace.

  1. To create a new workspace, click on the + Create workspace button. Then, click on Add workspace.

If you’re just starting with Baserow, we recommend you read our article on how to create a workspace and how to add collaborators to a workspace.

  1. Now that the workspace is set up, you can either create a database from scratch or choose a template from our template library. In this tutorial, we’ll use a template from the library.
  2. Click on the + Create new button to start creating a new database.
  3. Select the “From template” option to add a database from a template.
  4. Input “Customer Research” in the template search box.
  5. Click the Use this template button to add the template to the workspace.

Use this template

That’s it! we’ve successfully created a new database. Now we can populate, manage, and organize data in Baserow.

2. Obtain your Baserow API key

Next, we want to create a Baserow API token and give it the necessary permissions for reading and writing data.

  1. Click on your profile details and go to Settings.
  2. Click on the Database Tokens tab.
  3. Click Create token and follow the prompts to generate a new token.
  4. Generate a new API key and give it a name. Copy the generated API key and note it securely, you’ll need it to authenticate your requests.

Refer to this article to learn more about Baserow authentication and token types.

Obtain your Baserow API key

Now, let’s take a look at the database API documentation.

3. Reference the database API documentation

The rules and functions to follow to make an API call are laid out in the database documentation. Understanding this will help efficiently manage data retrieval and manipulations through the API.

REST APIs are core operational tools that enable organizations and developers to consume and build on top of Baserow’s various database capabilities. Baserow’s API follows REST semantics, uses JSON to encode objects, and relies on standard HTTP codes, and machine and human-readable errors to signal operation outcomes.

To access the database API documentation,

  1. Click on the vertical ellipsis beside the database.
  2. Select View API Docs from the menu.

The database API consists of different endpoints for specific actions. These endpoints can be found in the left sidebar.

Reference the database API documentation

Next, we’ll set up and use Baserow’s API with Insomnia or Postman.

4. Set up an API client

Open your preferred API client, such as Insomnia or Postman.

Insomnia is an open-source API development platform that allows you to create and manage API requests, write and run automated tests, and collaborate with team members. Postman also allows you to automate your API tests by creating collections of requests and tests.

We’ll be using Insomnia in this tutorial, but the same steps apply to any API that allows performing repetitive tests, regression testing, and integration testing.

Within Insomnia, create a new project then create a new HTTP request:

Set up API client with Insomnia

5. Configure the API request

  1. Set the request method to be used when the event occurs (e.g., GET, POST, PUT, DELETE). This is based on the action you want to perform with the API.
  2. Enter the API endpoint URL to https://api.baserow.io/. Refer to the API documentation for the endpoint URLs for various actions.
    • Add headers: Authorization: Token YOUR_API_TOKENKey: Authorization. Add the API token as an authorization header.
    • Value: Token YOUR_API_KEY (Replace YOUR_API_KEY with the API key you obtained in the earlier step).
    • Key: Content-Type
    • Value: application/json (or other applicable content types).
  3. If your API call requires a request body (e.g., creating a new row), add the necessary JSON data to the body.

6. CRUD Operations

Now, let’s explore create, read, update, and delete (CRUD) operations with Baserow’s API:

  • Create: Use POST requests to create new rows in your Baserow database. For example, to create a new row in Baserow, you can make a POST request to the /api/database/rows/table/{table_id}/ endpoint.
  • Read: Fetch data with GET requests. You can specify filters, sorting, and pagination.
  • Update: Modify existing rows by sending PUT or PATCH requests.
  • Delete: Remove rows using DELETE requests.

7. Make the API request

Click the Send button in Insomnia to test the connection. You’ll get a response with your Baserow data.

Check the response to make sure it has the expected data. You might need to refer to Baserow’s API documentation to understand the response.

Now, let’s explore how we can use Baserow’s API to create custom automation solutions and make any necessary improvements.

8. Build and test automation

Finally, integrate Baserow data into your automation solution using code snippets from the response. For instance, you can automate data transfer, trigger actions based on specific events in Baserow, or fetch data from external sources into Baserow.

Depending on your use case, schedule the script to run at specific intervals or utilize webhooks to trigger it in response to specific events within Baserow.

Before deploying your automation solution, thoroughly test it to ensure it functions as intended. Additionally, closely monitor the performance of the automation to guarantee accurate data transfer.

Summary

That’s it!

You’ve successfully set up Baserow, obtained an API key, and connected external tools. Now, the possibilities for enhancing your workflow efficiency are endless. You can synchronize data, trigger actions in external applications, or build custom workflows.

With Baserow, you can integrate with various applications, automate tasks, and streamline your workflow. For instance, you can create a new Baserow row whenever a new lead is added to a Google Sheets spreadsheet.

Feel free to explore more advanced features of Baserow’s API, like handling attachments, batch processing, or using webhooks for event-driven automation.

Other useful resources

The following articles may also be helpful:

If you run into any issues following this tutorial, feel free to reach out to the Baserow community, and someone will jump in to help.