Skip to main content
Data Infrastructure Insights
日本語は機械翻訳による参考訳です。内容に矛盾や不一致があった場合には、英語の内容が優先されます。

API 経由で Reporting Database にアクセスします

共同作成者 netapp-alavoie

Data Infrastructure Insightsの強力なAPIを使用すると、Cognos Reporting環境を介さずに、Data Infrastructure Insights Reportingデータベースに直接クエリを実行できます。

メモ このドキュメントでは、Data Infrastructure Insights Premiumエディションで利用できるData Infrastructure Insightsのレポート機能について説明します。

OData

Data Infrastructure Insights Reporting APIは、(Open Data Protocol)標準に従って"OData v4 の"Reportingデータベースを照会します。詳細または詳細については、ODataをご覧ください"このチュートリアルでは"

すべての要求は、URL_\https://<Data Infrastructure Insights URL>/rest/v1/dwh-management/odata_で始まります。

apiKey を生成します

詳細については、をご覧ください"データインフラ分析情報API"

API キーを生成するには、次の手順を実行します。

  • Data Infrastructure Insights環境にログインし、*[Admin]>[API Access]*を選択します。

  • [+API Access Token] をクリックします。

  • 名前と概要を入力します。

  • タイプには、 Data Warehouse _ を選択します。

  • 権限を読み取り / 書き込みに設定します。

  • 要望の有効期限を設定します。

  • [ 保存 ] をクリックし、 * キーをコピーして安全な場所に保存します。あとでフルキーにアクセスすることはできません。

APIkeysはに適してい同期または非同期_ます。

テーブルの直接クエリ

API キーを配置した状態で、 Reporting データベースの直接クエリを実行できるようになりました。長いURLは、\https://<Data Infrastructure Insightsの完全なURL >/rest/v1/dwh-management/odata/ではなく、表示目的で\https://…​/odata/に単純化できます。

次のような簡単なクエリを試してください

  • https://<Dataインフラ分析情報のURL>/reset/v1/dwh-management/odata/dwh_custom

  • https://<Dataインフラ分析情報のURL>/rest /v1/dwh-management/odata/dwh_inventory

  • https://<Dataインフラ分析情報のURL>/rest /v1/dwh-management/odata/dwh_inventory/storage

  • https://<Dataインフラ分析情報のURL>/rest /v1/dwh-management/odata/dwh_inventory/disk

  • https://…​/odata/dwh_custom/custom_queries

REST API の例

すべての呼び出しのURLは_\https://<Data Infrastructure Insights URL>/rest/v1/dwh-management/odata_です。

  • get/{schema}/**-レポートデータベースからデータを取得します。

形式:https://<Data Infrastructure Insights <schema_name>/<query>

例:

 https://<domain>/rest/v1/dwh-management/odata/dwh_inventory/fabric?$count=true&$orderby=name
結果:
{
   "@odata.context": "$metadata#fabric",
   "@odata.count": 2,
   "value": [
       {
           "id": 851,
           "identifier": "10:00:50:EB:1A:40:3B:44",
           "wwn": "10:00:50:EB:1A:40:3B:44",
           "name": "10:00:50:EB:1A:40:3B:44",
           "vsanEnabled": "0",
           "vsanId": null,
           "zoningEnabled": "0",
           "url": "https://<domain>/web/#/assets/fabrics/941716"
       },
       {
           "id": 852,
           "identifier": "10:00:50:EB:1A:40:44:0C",
           "wwn": "10:00:50:EB:1A:40:44:0C",
           "name": "10:00:50:EB:1A:40:44:0C",
           "vsanEnabled": "0",
           "vsanId": null,
           "zoningEnabled": "0",
           "url": "https://<domain>/web/#/assets/fabrics/941836"
        }
    ]
}

役に立つヒント

Reporting API クエリを使用する場合は、次の点に注意してください。

  • クエリペイロードには有効な JSON 文字列を指定する必要があります

  • クエリペイロードは 1 行に含める必要があります

  • 二重引用符はエスケープする必要があります。

  • タブは \t としてサポートされています

  • コメントは避けてください

  • 小文字のテーブル名がサポートされています

さらに、

  • 2 つのヘッダーが必要です。

    • 「 X-CloudInsights - apiKey 」という名前を付けます。

    • 属性値「 <apiKey> 」

APIキーは、お客様のData Infrastructure Insights環境に固有のものです。

同期か非同期か

デフォルトでは、APIコマンドは_synchronous_modeで動作します。つまり、要求を送信するとすぐに応答が返されます。ただし、クエリの実行に時間がかかることがあり、要求がタイムアウトする可能性があります。これを回避するには、request_asynchronously _を実行します。非同期モードでは、要求は実行の監視に使用するURLを返します。URLは準備ができたら結果を返します。

非同期モードでクエリを実行するには、ヘッダーを要求に追加し `Prefer: respond-async`ます。実行が成功すると、応答に次のヘッダーが含まれます。

Status Code: 202 (which means ACCEPTED)
preference-applied: respond-async
location: https://<Data Infrastructure Insights URL>/rest/v1/dwh-management/odata/dwh_custom/asyncStatus/<token>

ロケーションURLを照会すると、応答の準備ができていない場合は同じヘッダーが返され、応答の準備ができている場合はステータス200が返されます。応答コンテンツのタイプはtextで、元のクエリのhttpステータスとメタデータが含まれ、その後に元のクエリの結果が続きます。

HTTP/1.1 200 OK
 OData-Version: 4.0
 Content-Type: application/json;odata.metadata=minimal
 oDataResponseSizeCounted: true

 { <JSON_RESPONSE> }

すべての非同期クエリのリストと、準備ができているものを表示するには、次のコマンドを使用します。

 GET https://<Data Infrastructure Insights URL>/rest/v1/dwh-management/odata/dwh_custom/asyncList
応答の形式は次のとおりです。
{
   "queries" : [
       {
           "Query": "https://<Data Infrastructure Insights URL>/rest/v1/dwh-management/odata/dwh_custom/heavy_left_join3?$count=true",
           "Location": "https://<Data Infrastructure Insights URL>/rest/v1/dwh-management/odata/dwh_custom/asyncStatus/<token>",
           "Finished": false
       }
   ]
}