查看 Apigee Edge 說明文件。
前往
Apigee X說明文件。 資訊
您可以使用 Edge API 從某個機構環境匯出及匯入自訂報表。 這項實用技巧可讓您在不同機構組織中重複使用自己喜歡的自訂報表設計, 環境此外,您可以將設計 (簡單的 JSON 文字檔案) 儲存在 CSV 中。
首先,請使用名單分析報表定義 使用 API 取得為機構定義的所有報表 UUID:
curl -X GET "https://api.enterprise.apigee.com/v1/organizations/org-name/reports" \ -u email:password
每份報表的輸出內容都包含其顯示名稱 (在 Edge UI 中看到的名稱) 和其 UUID:
{
"qualifier": [
{
"displayName": "My Report 1",
"name": "cb7cd16a-44c4-0bc83c3b9c92"
},
{
"displayName": "My Other Report",
"name": "a7e3fc4e-992a2ffc0e3d49d"
},
...
]
}現在,請呼叫所需報表的 UUID 以擷取定義, 取得數據分析報表定義 也能使用 Google Cloud CLI 或 Compute Engine API在本例中,您取得了名為「我的報表 1」的報表:
curl -X GET "https://api.enterprise.apigee.com/v1/organizations/org-name/reports/cb7cd16a-44c4-0bc83c3b9c92" \ -u email:password
輸出結果會包含報表定義:
{
"chartType": "column",
"comments": [],
"createdAt": 1506922614000,
"createdBy": "11.111.121.57",
"dimensions": [
"apiproxy",
"proxy_pathsuffix",
"proxy_client_ip"
],
"displayName": "My Report 1",
"environment": "prod",
"lastModifiedAt": 1512435450000,
"lastModifiedBy": "111.111.121.57",
"lastViewedAt": 1512435450000,
"metrics": [
{
"function": "avg",
"name": "response_size"
},
{
"function": "avg",
"name": "request_size"
}
],
"name": "cb7cd16a-44c4-0bc83c3b9c92",
"organization": "myOrg",
"properties": [
{
"property": "__ui__",
"value": [
{
"name": "description"
},
{
"name": "accuracy"
}
]
}
],
"sortbyCols": [],
"tags": [],
"timeUnit": "hour"
}複製 JSON 輸出內容,並更新 environment 和 organization 欄位
以便匯入定義,然後使用
建立數據分析報表定義 API。
舉例來說,如要將定義匯入名為 destOrg 的機構的 test 環境:
curl -X POST -H "Content-Type: application/json" "https://api.enterprise.apigee.com/v1/organizations/destOrg/reports" \
-d "{
"chartType": "column",
"comments": [],
"createdAt": 1506922614000,
"createdBy": "11.111.121.57",
"dimensions": [
"apiproxy",
"proxy_pathsuffix",
"proxy_client_ip"
],
"displayName": "My Report 1",
"environment": "test",
"lastModifiedAt": 1512435450000,
"lastModifiedBy": "111.111.121.57",
"lastViewedAt": 1512435450000,
"metrics": [
{
"function": "avg",
"name": "response_size"
},
{
"function": "avg",
"name": "request_size"
}
],
"name": "cb7cd16a-44c4-0bc83c3b9c92",
"organization": "destOrg",
"properties": [
{
"property": "__ui__",
"value": [
{
"name": "description"
},
{
"name": "accuracy"
}
]
}
],
"sortbyCols": [],
"tags": [],
"timeUnit": "hour"
}" \
-u email:password 現在,您應該會在機構的 Edge UI 中看到這份報表。