Access Analytics custom reports data via API

0 0 236

Use the below API to get the report definition

curl -v https://api.enterprise.apigee.com/v1/organizations/{org_name}/reports/{report_UUID}

(Works only with Accept: application/json for now)

  "chartType" : "column",
  "comments" : [ ],
  "createdAt" : 1452125646894,
  "createdBy" : "BRoles",
  "dimensions" : [ "apiproxy", "request_verb", "proxy_pathsuffix" ],
  "displayName" : "WalAPI",
  "environment" : "prd01",
  "filter" : "",
  "lastModifiedAt" : 1476220665872,
  "lastModifiedBy" : "10.234.122.13",
  "lastViewedAt" : 1494653974715,
  "metrics" : [ {
    "function" : "avg",
    "name" : "total_response_time"
  }, {
    "function" : "avg",
    "name" : "target_response_time"
  }, {
    "function" : "avg",
    "name" : "request_processing_latency"
  }, {
    "function" : "avg",
    "name" : "response_processing_latency"
  }, {
    "function" : "sum",
    "name" : "message_count"
  }, {
    "function" : "sum",
    "name" : "is_error"
  } ],
  "name" : "7b81a847-cf7e-40cf-a78f-021c530952",
  "organization" : "prod",
  "properties" : [ {
    "property" : "__ui__",
    "value" : [ {
      "name" : "description"
    }, {
      "name" : "accuracy"
    } ]
  } ],
  "sortbyCols" : [ ],
  "tags" : [ ],
  "timeUnit" : "hour" 

That reportAPI is to get the definition but not for the data. If you want to get the data what you see in the UI for a time frame, you can call multiple APIs as below per each dimension

curl -v "https://api.enterprise.apigee.com/v1/organizations/{org}/environments/{environment}/stats/apiproxy?select=avg(total_response_time),avg(target_response_time),avg(request_processing_latency),avg(response_processing_latency),sum(message_count),sum(is_error)&sort=ASC&sortby=avg(total_response_time),avg(target_response_time),avg(request_processing_latency),avg(response_processing_latency),sum(message_count),sum(is_error)&timeRange=05%2F12%2F2017+21:36:00~05%2F12%2F2017+22:36:00&timeUnit=minute 

and then use a filter as below for the next level dimensions

curl -v "https://api.enterprise.apigee.com/v1/organizations/{org}/environments/{environment}/stats/request_verb?filter=(apiproxy+eq+%27TestAPI%27)&select=avg(total_response_time),avg(target_response_time),avg(request_processing_latency),avg(response_processing_latency),sum(message_count),sum(is_error)&sort=ASC&sortby=avg(total_response_time),avg(target_response_time),avg(request_processing_latency),avg(response_processing_latency),sum(message_count),sum(is_error)&timeRange=05%2F12%2F2017+21:37:00~05%2F12%2F2017+22:37:00&timeUnit=minute 

To group metrics by dimension (all or some)combinations, you'd comma-separate dimensions in the URI like this: /stats/apiproxy,target_response_code.

curl -v https://api.enterprise.apigee.com/v1/organizations/apigeedocs/environments/test/stats/apiproxy,request_verb?select=sum(message_count)&timeRange=05%2F15%2F2017%2000%3A00~05%2F20%2F2017%2023%3A59"
Version history
Last update:
‎06-15-2017 03:18 PM
Updated by: