Retool apps tutorial: Connect and query data
Learn how to connect a data source and retrieve customer data using queries.
This guide is part of a multi-page tutorial. If you're starting here, consider reviewing the previous steps and following the Retool apps tutorial in sequence.
A resource is a set of user-configured properties that determine how Retool interacts with a data source, such as an API. You create a resource for each data source you want to use with Retool. You can then select the resource when writing a query so you can interact with the data.
1. Generate a mock API with customer data
Use the mock API generator below to generate a fully functional temporary REST API with sample data that you can use.
- Select the sample data set.
- Specify the number of Items that the data set should include.
- Click Generate API to generate the API with sample data.
- Click Copy URL to copy the API URL to your clipboard.
The mock API is for testing purposes only and does not require authentication. Do not attempt to use it for production purposes or with any type of sensitive information.
2. Create a resource query
First, add a resource query to retrieve customer data. Before the query can do this, you must create the necessary resource. In this example, you will create a resource directly from the Code tab.
Click in the left panel to open the Code tab. In the customersPage section, click and select Resource query.
query1 populates with a list of suggested resources in your Retool organization for which you have access.