Create a new resource in Retool and select "OpenAPI" as the type.
Enter a name for the resource and the url for the api spec in the "Specification URL" field. Depending on how authentication is set up for your API, you may need to enter URL parameters or headers, or set the method via the "Authentication" dropdown.
See here for more details on authentication.
Resources > Add > OpenAPI
Once you have entered your spec URL you can click "Test Connection" to validate that the spec can be reached and parsed by Retool's API server. The spec will also need to be reachable from your browser when used to build queries for apps.
You can now select your newly-created OpenAPI resource from the Resource dropdown when creating queries in your Retool apps.
The OpenAPI spec will define all the available endpoints. You can select the endpoint you'd like to call from the dropdown. Documentation will be pulled from the spec and displayed in the query editor.
For each endpoint, Retool's query editor will parse the spec and display inputs based on the request parameters that are listed. For example, if the parameter is listed as an array of enums the query editor will display a multi-select UI.
Objects in the request parameters are expanded to have the appropriate keys and arrays of objects can be built in the editor.
You can display the results of OpenAPI queries as with any other query in Retool.
You can explore a number of templates that use OpenAPI in the Retool product.
- If you are new to OpenAPI, there is extensive helpful documentation and walkthroughs on best practices at (https://swagger.io/specification/)
Updated 7 months ago