> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cloud.cdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Retool

> You can connect Retool to Connect AI via the OpenAPI specification or via the Virtual SQL Server API. Follow the prerequisites and steps for the method you want to use.

## Prerequisites for Connecting via OpenAPI

Before you connect via OpenAPI, you must first do the following:

* In Connect AI:
  * Connect a data source to your Connect AI account. See [Sources](/ja/Sources) for more information.
  * [Add a workspace](/ja/Workspaces#add-a-workspace) to Workspaces.
  * [Add assets](/ja/Workspaces#workspace-assets) to your workspace.
  * Generate a Personal Access Token (PAT) on the [Settings](/ja/Settings#personal-access-tokens) page. Copy this down, as it acts as your password during authentication.
* In Retool:
  * Go to **Settings** > **API** and click **Create new** to generate an access token. See the [Retool documentation](https://docs.retool.com/org-users/guides/retool-api/authentication) for more information.

## Connect to Connect AI via OpenAPI

To establish a connection from Retool to Connect AI via OpenAPI, follow these steps.

<Steps>
  <Step>
    In **Workspaces** in Connect AI, select a workspace and copy the OpenAPI URL for the workspace. Keep the default options. See [OpenAPI](/ja/API/OpenAPI) for more information.

    <Frame>
      <img src="https://mintcdn.com/cdata/6pGFG61-t-b5cPZl/ja/images/retool_client_endpoints_URL.png?fit=max&auto=format&n=6pGFG61-t-b5cPZl&q=85&s=ae018a713a8d914351cee73d5447854b" alt="" width="752" height="531" data-path="ja/images/retool_client_endpoints_URL.png" />
    </Frame>
  </Step>

  <Step>
    Log in to Retool.
  </Step>

  <Step>
    In the **Resources** tab, click **Create new** > **Resource**.

    <Frame>
      <img src="https://mintcdn.com/cdata/6pGFG61-t-b5cPZl/ja/images/retool_client_create_new.png?fit=max&auto=format&n=6pGFG61-t-b5cPZl&q=85&s=15a518102d7f2c1978599421ddab1d1c" alt="" width="1894" height="863" data-path="ja/images/retool_client_create_new.png" />
    </Frame>
  </Step>

  <Step>
    In the **Select a resource type** search bar, enter *OpenAPI*.

    <Frame>
      <img src="https://mintcdn.com/cdata/6pGFG61-t-b5cPZl/ja/images/retool_client_openapi.png?fit=max&auto=format&n=6pGFG61-t-b5cPZl&q=85&s=f35b95011accc83391c0519ac1463541" alt="" width="710" height="738" data-path="ja/images/retool_client_openapi.png" />
    </Frame>
  </Step>

  <Step>
    Click **OpenAPI**. The **Configure OpenAPI** screen appears.
  </Step>

  <Step>
    Enter the following information to configure the OpenAPI connector:

    * **Name**—the name to use to identify the connector.
    * **Specification URL**—the OpenAPI URL you copied in Connect AI. Paste the URL here.
    * **Forward headers when fetching OpenAPI spec**—must be selected.
    * **Headers**—Authorization is *Basic*. Then, Retool requires that you Base64 encode your Connect AI username and PAT using the input format *username:PAT*. The PAT is the token you created in the prerequisites. You can use a tool such as the one [here](https://www.base64encode.org/). Click **Encode** and copy the Base64 encoded result into this field. For example, for *`test@cdata.com:12345`*, the Base64 encoded value is *dGVzdEBjZGF0YS5jb206MTIzNDU=*.
    * **Username**—Connect AI のユーザー名を入力します。ユーザー名は、Connect AI の画面の右上に表示されています。例：*`test@cdata.co.jp`*
    * **Password**—[Settings](/ja/Settings#personal-access-tokens) ページで生成したPAT を入力します。

    <Frame>
      <img src="https://mintcdn.com/cdata/6pGFG61-t-b5cPZl/ja/images/retool_client_openapi_config.png?fit=max&auto=format&n=6pGFG61-t-b5cPZl&q=85&s=355d4c4b1238ef11c24939524654db83" alt="" width="840" height="812" data-path="ja/images/retool_client_openapi_config.png" />
    </Frame>
  </Step>

  <Step>
    Click **Test connection** to test your connection configuration.
  </Step>

  <Step>
    Once you have a successful connection, click **Create resource**.
  </Step>

  <Step>
    Create the app in Retool in which to integrate your data.
  </Step>

  <Step>
    Click **Create resource query**.

    <Frame>
      <img src="https://mintcdn.com/cdata/6pGFG61-t-b5cPZl/ja/images/retool_client_create_resource.png?fit=max&auto=format&n=6pGFG61-t-b5cPZl&q=85&s=c941ee62ed867ee395c19c941669efe9" alt="" width="1920" height="926" data-path="ja/images/retool_client_create_resource.png" />
    </Frame>
  </Step>

  <Step>
    Select the new resource you created, and view the endpoints that are available.

    <Frame>
      <img src="https://mintcdn.com/cdata/6pGFG61-t-b5cPZl/ja/images/retool_client_endpoints.png?fit=max&auto=format&n=6pGFG61-t-b5cPZl&q=85&s=51b21eee950370569597a0a56707262c" alt="" width="1915" height="864" data-path="ja/images/retool_client_endpoints.png" />
    </Frame>
  </Step>

  <Step>
    You can now build your app with the data.

    <Frame>
      <img src="https://mintcdn.com/cdata/6pGFG61-t-b5cPZl/ja/images/retool_client_create_app.png?fit=max&auto=format&n=6pGFG61-t-b5cPZl&q=85&s=230d82f768b356cecb1ec372a81a232c" alt="" width="1919" height="917" data-path="ja/images/retool_client_create_app.png" />
    </Frame>
  </Step>
</Steps>

## Prerequisites for Connecting via Virtual SQL Server API

Before you connect, you must first do the following:

* Connect a data source to your Connect AI account. See [Sources](/ja/Sources) for more information.
* Generate a Personal Access Token (PAT) on the [Settings](/ja/Settings#personal-access-tokens) page. Copy this down, as it acts as your password during authentication.

## Connect to Connect AI via Virtual SQL Server API

To establish a connection from Retool to the Connect AI Virtual SQL Server API, follow these steps.

<Steps>
  <Step>
    Log in to Retool.
  </Step>

  <Step>
    Under **Resources**, click **Connect a resource**.

    <Frame>
      <img src="https://mintcdn.com/cdata/6pGFG61-t-b5cPZl/ja/images/retool_client_01.png?fit=max&auto=format&n=6pGFG61-t-b5cPZl&q=85&s=04ac44525f238b3a9ffa73648783828d" alt="" width="1408" height="329" data-path="ja/images/retool_client_01.png" />
    </Frame>
  </Step>

  <Step>
    Enter "Microsoft SQL" in the search bar and click the resulting option.

    <Frame>
      <img src="https://mintcdn.com/cdata/6pGFG61-t-b5cPZl/ja/images/retool_client_02.png?fit=max&auto=format&n=6pGFG61-t-b5cPZl&q=85&s=32b4651eae34fcc6896ddaaacfc26aec" alt="" width="632" height="258" data-path="ja/images/retool_client_02.png" />
    </Frame>
  </Step>

  <Step>
    Enter the connection settings.

    * **Name**—a name for the connection to Connect AI
    * **Host**—*tds.cdata.com*
    * **Port**—*14333*
    * **Database name**—接続したいConnect AI データソースのConnection Name を入力します。例：*Salesforce1*
    * **Database username**—Connect AI のユーザー名を入力します。ユーザー名は、Connect AI の画面の右上に表示されています。例：*`test@cdata.co.jp`*
    * **Database password**—[Settings](/ja/Settings#personal-access-tokens) ページで生成したPAT を入力します。

    <Frame>
      <img src="https://mintcdn.com/cdata/6pGFG61-t-b5cPZl/ja/images/retool_client_03.png?fit=max&auto=format&n=6pGFG61-t-b5cPZl&q=85&s=03acaa7ef4582393fb63296321e454cb" alt="" width="1085" height="791" data-path="ja/images/retool_client_03.png" />
    </Frame>
  </Step>

  <Step>
    Click **Test connection**. If it succeeds, you can click **Create resource**. Your connection to Connect AI is ready to use.
  </Step>
</Steps>
