API를 통해 보고 데이터베이스에 액세스
Data Infrastructure Insights 의 강력한 API를 사용하면 사용자는 Cognos Reporting 환경을 거치지 않고도 Data Infrastructure Insights Reporting 데이터베이스를 직접 쿼리할 수 있습니다.
|
|
이 문서는 Data Infrastructure Insights Data Infrastructure Insights Insights 보고 기능에 대해 설명합니다. |
오다타
Data Infrastructure Insights Reporting API는 다음을 따릅니다."OData v4" (오픈 데이터 프로토콜) 보고 데이터베이스 쿼리를 위한 표준입니다. 자세한 내용을 보거나 자세히 알아보려면 다음을 확인하세요."이 튜토리얼" OData에 관하여.
모든 요청은 url _\https://< Data Infrastructure Insights URL>/rest/v1/dwh-management/odata_로 시작합니다.
APIKey 생성
더 자세히 알아보세요"Data Infrastructure Insights API" .
API 키를 생성하려면 다음을 수행하세요.
-
Data Infrastructure Insights 환경에 로그인하고 *관리자 > API 액세스*를 선택합니다.
-
"+ API 액세스 토큰"을 클릭합니다.
-
이름과 설명을 입력하세요.
-
유형으로 _데이터 웨어하우스_를 선택하세요.
-
권한을 읽기/쓰기로 설정합니다.
-
욕망의 만료일을 설정하세요.
-
"저장"을 클릭한 다음, 키를 복사하여 안전한 곳에 저장하세요. 나중에 전체 키에 접근할 수 없습니다.
API키는 다음에 유용합니다.동기 또는 비동기 .
테이블 직접 쿼리
API 키가 있으므로 이제 보고 데이터베이스에 대한 직접 쿼리가 가능해졌습니다. 긴 URL은 표시 목적으로 전체 https://< Data Infrastructure Insights URL>/rest/v1/dwh-management/odata/ 대신 https://…/odata/로 단순화될 수 있습니다.
다음과 같은 간단한 쿼리를 시도해 보세요.
-
https://< Data Infrastructure Insights URL>/rest/v1/dwh-management/odata/dwh_custom
-
https://< Data Infrastructure Insights URL>/rest/v1/dwh-management/odata/dwh_inventory
-
https://< Data Infrastructure Insights URL>/rest/v1/dwh-management/odata/dwh_inventory/storage
-
https://< Data Infrastructure Insights URL>/rest/v1/dwh-management/odata/dwh_inventory/disk
-
https://…/odata/dwh_custom/커스텀_쿼리
REST API 예제
모든 통화에 대한 URL은 _\https://< Data Infrastructure Insights URL>/rest/v1/dwh-management/odata_입니다.
-
GET /{schema}/** - 보고 데이터베이스에서 데이터를 검색합니다.
형식: https://< Data Infrastructure Insights URL>/rest/v1/dwh-management/odata/<스키마_이름>/<쿼리>
예:
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 문자열이어야 합니다.
-
쿼리 페이로드는 단일 줄에 포함되어야 합니다.
-
큰따옴표는 이스케이프해야 합니다. 예: \"
-
탭은 \t로 지원됩니다.
-
댓글을 피하세요
-
소문자 테이블 이름이 지원됩니다.
추가로:
-
2개의 헤더가 필요합니다.
-
이름 “X-CloudInsights-ApiKey”
-
속성 값 “<apikey>”
-
귀하의 API 키는 귀하의 Data Infrastructure Insights 환경에 따라 달라집니다.
동기식인가 비동기식인가?
기본적으로 API 명령은 동기 모드로 작동합니다. 즉, 요청을 보내면 응답이 즉시 반환됩니다. 그러나 때로는 쿼리를 실행하는 데 시간이 오래 걸릴 수 있으며, 이로 인해 요청 시간이 초과될 수 있습니다. 이 문제를 해결하려면 요청을 비동기적으로 실행할 수 있습니다. 비동기 모드에서는 요청이 실행을 모니터링할 수 있는 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이 반환됩니다. 응답 내용은 텍스트 유형이며 원래 쿼리의 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
}
]
}