通过 API 访问报告数据库
提供者
Cloud Insights 功能强大的 API 允许用户直接查询 Cloud Insights 报告数据库,而无需通过 Cognos 报告环境。
|
本文档涉及中提供的 Cloud Insights 报告功能 "高级版"。 |
OData
Cloud Insights 报告 API 遵循 "OData v4" (开放式数据协议)用于查询报告数据库的标准。要了解更多信息或了解更多信息,请查看 "本教程" 在 OData 上。
所有请求均以 URL : https://<Cloud Insights URL>/rest/v1/dwh-management/OData 开头
生成一个 APKey
了解更多信息 "Cloud Insights APIs"。
要生成 API 密钥,请执行以下操作:
-
登录到 Cloud Insights 环境并选择 * 管理 > API 访问 * 。
-
单击 "+ API Access Token" 。
-
输入名称和问题描述。
-
对于类型,请选择 _Data Warehouse 。
-
将权限设置为读 / 写。
-
设置所需要的到期日期。
-
单击 " 保存 " ,然后 * 复制密钥并将其保存 * 到安全位置。您稍后将无法访问完整密钥。
您可以使用 Sync 或 Async 使用此类按键。
直接查询表
使用 API 密钥后,可以直接查询报告数据库。为了便于显示,长 URL 可以简化为 https://…/odata/ ,而不是完整的 https://<Cloud Insights URL>/rest/v1/dwh-management/OData/
请尝试类似的简单查询
-
https://<Cloud Insights URL>/rest/v1/dwh-management/OData/dwh_custom
-
https://<Cloud Insights URL>/rest/v1/dwh-management/OData/dwh_inventory
-
https://<Cloud Insights URL>/rest/v1/dwh-management/OData/dwh_inventory/storage
-
https://<Cloud Insights URL>/rest/v1/dwh-management/OData/dwh_inventory/disk
REST API 示例
所有调用的 URL 为: https://<Cloud Insights URL>/rest/v1/dwh-management/OData 。
-
GET /{schema}/**-从报告数据库检索数据。
格式: https://<Cloud Insights URL>/rest/v1/dwh-management/OData/<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" } ] }
有用的提示
使用报告 API 查询时,请记住以下几点。
-
查询有效负载必须是有效的 JSON 字符串
-
查询有效负载必须包含在一行中
-
必须转义双引号,即 \"
-
选项卡支持为 \t
-
避免注释
-
支持小写表名称
此外:
-
需要 2 个标题:
-
将名称命名为 X-CloudInsights ApiKey
-
属性值 "<apikey>"
-
您的 API 密钥将特定于您的 Cloud Insights 环境。