Retool Fundamentals: Lesson 1
Learn how to connect your data source by creating a resource.
The first step in building a Retool app is connecting your data source. Retool supports most databases and APIs, and you can use built-in integrations to connect to popular data sources with minimal configuration. You connect a data source by creating a resource in Retool. This guide uses a REST API as the resource.
1. Generate an API and sample data for your app
To work through Retool Fundamentals, you'll use Retool's API generator to create a test REST API with some sample data. When building your own apps, you'll often use an existing data source.
For this app, you'll generate a data set that includes the user's ID, name, email address, and whether the user's access is blocked. When you're ready, click the Generate API button and save the Endpoint URL.
2. Create a resource to connect your data source
Navigate to the Resources tab from the Retool homepage and click Create new > Resource. Select REST API and name the resource. In the Base URL field, paste the endpoint URL from the previous step and create the resource.
If this is your first time using Retool, you'll see a prompt for creating an app after saving the resource. Go ahead and create an app and name it User management
. If you don't see a prompt, navigate to the Apps tab in Retool and create an app named User management
.
3. Write a test query
Queries are covered in more detail later, but it's a good idea to run one now to verify the connection to your resource. When you created the app, Retool automatically added query1
to it. You can find this query in the lower left corner of the bottom panel. Click on the query1
text and rename the query to getUsers
.
You can see that the resource you just added is selected, and that the query sends a GET request to your API. Click Run to verify the query works. You'll see a success message and a JSON response with your data.
Wrap up
Now that you have a resource you can access, it's time to start building your UI.
You can test your knowledge below or move on to the next lesson.
Updated 3 months ago
Continue to the next lesson to assemble your app's user interface.