Connect to CircleCI
You can connect to CircleCI and make it available as a resource. Once complete, you can write queries to interact with the CircleCI API.
Requirements
All users for Retool organizations on Free or Team plans have global Edit permissions and can add, edit, and remove resources. If your organization manages user permissions for resources, you must be a member of a group with Edit all permissions.
To create your CircleCI resource, you need:
CircleCI uses API token authentication. You must provide an API token for Retool to authorize requests. Refer to the CircleCI documentation on authenticating requests to learn how to obtain your API token.
If CircleCI is behind a firewall, you must also allow access from Retool's IP addresses. Add these IP addresses to your firewall's allowlist before you create the resource.
1. Create a new resource
Sign in to your Retool organization and navigate to the Resources tab. Click Create new, then select Resource.
Retool can connect to almost any API or database, and has built-in integrations for popular data sources. Select the CircleCI integration.
2. Configure the resource
Provide the necessary details to configure the resource so Retool can connect to CircleCI. Not all settings are required but refer to the CircleCI documentation to learn what is needed.
General
These settings configure the name and location of the resource within Retool.
Name
The name to use for the resource (e.g., CircleCI).
Folder
The folder in which to save the resource.
Description
A brief description of the resource (e.g., CircleCI data).
Credentials
These settings configure how Retool connects to CircleCI.
Personal API Token
The API token used to authenticate requests.
3. Save the resource
Click Create resource to complete the setup. You can then click either Create an app to immediately start building a Retool app or Back to resources to return to the list of resources.
Wrap up
Your CircleCI resource is now ready to use. You write queries to make API requests by specifying the request method and endpoint, additional parameters to include, and the request body.
To verify you can successfully interact with CircleCI, write a test query to retrieve some data. The following example retrieves the workflow record for the specified workflow.
- Request
- Response
GET https://circleci.com/api/v2/workflow/5034460f-c7c4-4c43-9457
{
"pipeline_id": "5034460f-c7c4-4c43-9457",
"canceled_by": "026a6d28-c22e-4aab-a8b4-bd7131a8ea35",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "build-and-test",
"project_slug": "gh/CircleCI-Public/api-preview-docs",
"errored_by": "c6e40f70-a80a-4ccc-af88-8d985a7bc622",
"tag": "setup",
"status": "success",
"started_by": "03987f6a-4c27-4dc1-b6ab-c7e83bb3e713",
"pipeline_number": "25",
"created_at": "2019-08-24T14:15:22Z",
"stopped_at": "2019-08-24T14:15:22Z"
}