【ノーコード】Slingshot からAPI のデータに接続するバックエンドAPI を開発

杉本和也
杉本和也
リードエンジニア
SlingshotからAPIへのAPI接続でお困りですか?CData API Serverならコーディング不要でAPI構築が10分で完了。無償トライアルですぐにスタート。



CData API Server を使って、Slingshot から API に接続してダッシュボードを作成する方法を説明します。

API Server の設定

以下のリンクからAPI Server の無償トライアルをスタートしたら、セキュアなAPI OData サービスを作成していきましょう。

API への接続

Slingshot からAPI のデータを操作するには、まずyour API への接続を作成・設定します。

  1. API Server にログインして、「Connections」をクリック、さらに「接続を追加」をクリックします。 接続を追加
  2. 「接続を追加」をクリックして、データソースがAPI Server に事前にインストールされている場合は、一覧から「API」を選択します。
  3. 事前にインストールされていない場合は、コネクタを追加していきます。コネクタ追加の手順は以下の記事にまとめてありますので、ご確認ください。
    CData コネクタの追加方法はこちら >>
  4. それでは、API への接続設定を行っていきましょう! 接続設定
  5. 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:

    1. Click "+ Add"
    2. Set the Name for the table
    3. Set Request URL to the API endpoint you wish to work with
    4. (Optional) In Parameters, add the required URL Parameters for your API endpoint
    5. (Optional) In Headers, add the required HTTP headers for the API endpoint
    6. In Table Data click " Configure"
    7. Review the response from the API and click "Next"
    8. Select which element to use as the Repeated Elements and which elements to use as Columns and click "Next"
    9. Preview the tabular model of the API response and click "Confirm"
  6. 接続情報の入力が完了したら、「保存およびテスト」をクリックします。

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:

  1. Click "+ Add"
  2. Set the Name for the table
  3. Set Request URL to the API endpoint you wish to work with
  4. (Optional) In Parameters, add the required URL Parameters for your API endpoint
  5. (Optional) In Headers, add the required HTTP headers for the API endpoint
  6. In Table Data click " Configure"
  7. Review the response from the API and click "Next"
  8. Select which element to use as the Repeated Elements and which elements to use as Columns and click "Next"
  9. Preview the tabular model of the API response and click "Confirm"

API Server のユーザー設定

次に、API Server 経由でAPI にアクセスするユーザーを作成します。「Users」ページでユーザーを追加・設定できます。やってみましょう。

  1. 「Users」ページで ユーザーを追加をクリックすると、「ユーザーを追加」ポップアップが開きます。
  2. 次に、「ロール」、「ユーザー名」、「権限」プロパティを設定し、「ユーザーを追加」をクリックします。
  3. その後、ユーザーの認証トークンが生成されます。各ユーザーの認証トークンとその他の情報は「Users」ページで確認できます。

API 用のAPI エンドポイントの作成

ユーザーを作成したら、API のデータ用のAPI エンドポイントを作成していきます。

  1. まず、「API」ページに移動し、 「 テーブルを追加」をクリックします。
  2. アクセスしたい接続を選択し、次へをクリックします。
  3. 接続を選択した状態で、各テーブルを選択して確認をクリックすることでエンドポイントを作成します。

OData のエンドポイントを取得

以上でAPI への接続を設定してユーザーを作成し、API Server でAPI データのAPI を追加しました。これで、OData 形式のAPI データをREST API で利用できます。API Server の「API」ページから、API のエンドポイントを表示およびコピーできます。

(任意)オンプレミスDB やファイルからのAPI Server 使用

オンプレミスRDB やExcel / CSV などのファイルのデータをセキュアに外部公開する場合には、API Server のCloud Gateway / SSH ポートフォワーディングが便利です。Cloud Gateway の設定方法 記事を参考にしてください。

Slingshot にデータソースを追加する

CData API Server の設定が完了したら、Slingshot 側に接続設定を追加しましょう。

  1. Slingshot の対象のワークスペースに移動して「データソース」タブに移動し「+データソース」をクリックします。
  2. データソースの一覧から利用したいサービスを選択します。ここで先程CData API Server で設定したOData エンドポイントの接続を追加します。
  3. 「URL」にOData エンドポイントのURL を指定し「先制認証を使用する」にチェックを入れます。その上で「資格情報」を追加しましょう。
  4. 資格情報の種類は「汎用資格情報」になります。合わせてCData API Server のユーザー名を入力し、パスワードには先程生成したトークンを入力します。
  5. あとは「データソースの追加」をクリックすれば、データソースの接続設定は完了になります。

ダッシュボードを作成する

すべての準備が整ったのでAPI のデータを活用してダッシュボードを作成していきましょう。

  1. 「ダッシュボード」タブに移動して「+ダッシュボード」をクリックします。
  2. 先程追加したCData API Server へのOData フィードデータソースが表示されるので、これを選択します。
  3. すると、事前にCData API Server 上で登録しておいたテーブルの一覧がエンティティのセットとして表示されるので、任意のエンティティを選択しましょう。
  4. これでSlingshot 上に対象のデータがシームレスに読み込まれます。あとは可視化するためのラベルや値を選択することで、以下のように簡単にビジュアライズが実施できます。

まとめと30日の無償評価版のご案内

このように API 内のデータをSlingshot で利用することができるようになります。CData API Server は、30日の無償評価版があります。是非、お試しいただき、Slingshot からのデータ参照を体感ください。

はじめる準備はできましたか?

詳細はこちら、または無料トライアルにお申し込みください:

CData API Server お問い合わせ