Metabase で API のデータを連携利用する方法
Metabase は、インタラクティブなダッシュボードを作成できるオープンソースのデータ可視化ツールです。CData Connect AI と組み合わせることで、リアルタイムのAPI のデータにリンクされたビジュアライゼーションやダッシュボードを簡単に作成できます。この記事では、your API に接続し、API のデータ を使用してシンプルなビジュアライゼーションを構築する方法を説明します。
CData Connect は your API 専用のクラウド間インターフェースを提供し、データをレプリケートすることなく、Metabase でリアルタイムのAPI のデータを簡単に連携できます。Connect はMetabase からSQL Server データベースと同じように見え、最適化されたデータ処理を標準で使用して、サポートされているすべてのSQL 操作(フィルター、JOIN など)を your API に直接プッシュし、サーバーサイド処理を活用してAPI のデータを迅速に返します。
Metabase 用に your API への接続を設定
Metabase から your API への接続は、CData Connect AI によって実現されます。Metabase からAPI のデータを操作するには、まず your API 接続を作成し設定します。
- Connect AI にログインして「Sources」をクリックし、 Add Connection をクリックします
- Add Connection パネルから「API」を選択します
-
your API への接続に必要な認証プロパティを入力します。
To connect to your API, configure the following properties on the Global Settings page:
- In Authentication, select the Type and fill in the required properties
- In Headers, add the required HTTP headers for your API
- In Pagination, select the Type and fill in the required properties
After the configuring the global settings, navigate to the Tables to add tables. For each table you wish to add:
- Click "+ Add"
- Set the Name for the table
- Set Request URL to the API endpoint you wish to work with
- (Optional) In Parameters, add the required URL Parameters for your API endpoint
- (Optional) In Headers, add the required HTTP headers for the API endpoint
- In Table Data click " Configure"
- Review the response from the API and click "Next"
- Select which element to use as the Repeated Elements and which elements to use as Columns and click "Next"
- Preview the tabular model of the API response and click "Confirm"
- Save & Test をクリックします
-
Add your API Connection ページの「Permissions」タブに移動し、ユーザーベースの権限を更新します。
Personal Access Token の追加
REST API、OData API、またはVirtual SQL Server 経由でConnect AI に接続する場合、Personal Access Token(PAT)を使用してConnect AI への接続を認証します。アクセス管理の粒度を維持するために、サービスごとに個別のPAT を作成することをお勧めします。
- Connect AI アプリの右上にある歯車アイコン()をクリックして設定ページを開きます。
- Settings ページで「Access Tokens」セクションに移動し、 Create PAT をクリックします。
-
PAT に名前を付けて「Create」をクリックします。
- Personal Access Token は作成時にのみ表示されるため、必ずコピーして安全な場所に保存してください。
接続の設定とPAT の生成が完了したら、Metabase からAPI のデータに接続する準備が整いました。
Metabase からCData Connect AI に接続
Connect AI で接続を作成したら、Metabase インスタンスに移動します。SQL Server インターフェースを使用してConnect AI に接続します。
- 管理画面(Settings -> Admin)に移動し、「Databases」タブから「Add Database」をクリックします
- Connect AI への接続を設定し、「Save」をクリックします
- Database type: 「SQL Server」を選択します
- Name: 接続に名前を付けます(例:「your API (Connect AI)」)
- Host: tds.cdata.com
- Port: 14333
- Database name: 先ほど作成した接続の名前(例:API1)
- Username: Connect AI のユーザー名(例:[email protected])
- Password: 先ほど作成したPAT
- Use a secure connection (SSL) にチェックを入れます
Metabase で API のデータを実行
Connect AI への接続を設定したら、your API にクエリを実行してビジュアライゼーションを構築できます。
- 「Write SQL」ツールを使用してAPI のデータを取得します
- CData Connect AI の your API 接続に基づいてSQL クエリを記述します。例:
SELECT title, body FROM posts WHERE userId = '12345'
- 「Visualization」画面に移動し、ビジュアライゼーションを選択して設定します
詳細情報と無償トライアル
これで、Metabase でAPI のデータからシンプルなビジュアライゼーションを構築できました。Metabase では、SQL Server データベースと同じようにリアルタイムのAPI のデータを引き続き操作できます。your API(およびその他100以上のデータソース)へのリアルタイム接続の詳細については、Connect AI ページをご覧ください。無償トライアルに登録して、今すぐMetabase でリアルタイムのAPI のデータを活用してみてください。