Portal Metrics API

The Portal Metrics API can be used to retrieve various metrics for the aan. The API consists of the following RESTful resources: 
apip42
The Portal Metrics API can be used to retrieve various metrics for the 
API Portal
. The API consists of the following RESTful resources: 
  •  
    errors
    Lets you retrieve error metrics for APIs or applications.
  •  
    hits
    Lets you retrieve hit metrics for APIs or applications. 
  •  
    latency
    Lets you retrieve latency metrics for APIs.
  •  
    usage
    Lets you retrieve usage metrics for account plans.
Requests and responses are in JSON format.
The Real-Time Analytics page in the 
API Portal
 (accessible from 
Analytics
 in the menu) uses this API to visualize metrics data. Integrating with the Portal Metrics API lets you retrieve metrics data for use with your own BI tools, potentially create mash-ups with other corporate data to generate a richer data set, and allows you to create your own custom data visualizations, among other potential benefits.
Accessing the Portal Metrics API
You can call the Portal Metrics API from your external client application, and try it out using the API Explorer in the 
API Portal
.
 
To try out the API in the API Portal:
 
  1. Log in to the 
    API Portal
     as a Portal administrator for the intended tenant. 
  2. Select 
    Publish
    Portal
     
    APIs
    .
  3. Select the 
    Portal Metrics API
     option from the drop-down list. The API Explorer appears in the right pane, showing the Portal Metrics API.
Authentication
All API calls require a valid OAuth token.
Example
A sample Swagger JSON file can be downloaded from here
alpha
{ "swagger": "2.0", "info": { "title": "", "description": "", "version": "" }, "basePath": "\/api\/{tenantName}\/analytics\/metrics\/v1", "tags": [ { "name": "errors", "description": "Error metrics operations" }, { "name": "hits", "description": "Hit metrics operations" }, { "name": "latency", "description": "Latency metrics operations" }, { "name": "usage", "description": "Account plan usage metrics operations" } ], "schemes": [ "http" ], "paths": { "\/errors\/{type}": { "get": { "tags": [ "errors" ], "summary": "Returns error metrics for APIs or applications", "operationId": "getErrorMetricsUsingGET", "description": "Returns a list of error metrics for APIs or applications.", "consumes": [ "application\/json" ], "produces": [ "application\/json" ], "parameters": [ { "name": "type", "in": "path", "description": "The type of construct to return error metrics for. Options are: `apis`, `apps`. Defaults to `apis`", "required": true, "type": "string", "default": "apis", "enum": [ "apis", "apps" ] }, { "name": "timerange", "in": "query", "description": "The request time period. Options are: `hour` (the last 60 minutes including the current minute), `day` (the last 24 hours including the current hour), `week` (the last 7 days including today), `month` (the last 30 days including today), `year` (the last 365 days including today), `custom` (requires `startDate` and `endDate` values). Defaults to `week`", "required": false, "type": "string", "default": "week", "enum": [ "hour", "day", "week", "month", "year", "custom" ] }, { "name": "startDate", "in": "query", "description": "The start date for the query in YYYY-MM-DD format. **Only** applicable to (and required if) `timerange=custom`. Will be converted to `startTimeGMT` in the response. Defaults to one week prior to the current GMT datetime on your local machine", "required": false, "type": "string" }, { "name": "endDate", "in": "query", "description": "The end date for the query in YYYY-MM-DD format. **Only** applicable to (and required if) `timerange=custom`. The `endDate` must be after the `startDate`. Will be converted to `endTimeGMT` in the response. Defaults to the current GMT datetime on your local machine", "required": false, "type": "string" }, { "name": "appIds", "in": "query", "description": "A comma separated list of applications IDs for which error metrics will be returned", "required": false, "type": "string" }, { "name": "apiIds", "in": "query", "description": "A comma separated list of API IDs for which error metrics will be returned", "required": false, "type": "string" }, { "name": "proxyIds", "in": "query", "description": "A comma separated list of proxy (API Gateway server) IDs for which error metrics will be returned", "required": false, "type": "string" }, { "name": "buckets", "in": "query", "description": "Lets you group the result set based on a certain type. Options are: `apis`, `apps`, `serviceErrors`, `policyErrors`, `methodType`", "required": false, "type": "string", "enum": [ "apis", "apps", "serviceErrors", "policyErrors", "methodType" ] }, { "name": "sortorder", "in": "query", "description": "Specifies the sort order for bucketed entries (see `buckets`). You **must** specify a field to sort by (see `sortby`). Allowed values are: `asc` (ascending), `desc` (descending). Defaults to `desc`", "required": false, "type": "string", "default": "desc", "enum": [ "desc", "asc" ] }, { "name": "sortby", "in": "query", "description": "Specifies the type of record to sort bucketed entries by (see `buckets`). You **must** specify the sort order (see `sortorder`). Allowed values are: `errors`, `errorrate`, `appName`, `apiName`. Defaults to `errors`" , "required": false, "type": "string", "default": "errors", "enum": [ "errors", "errorrate", "appName", "apiName" ] }, { "name": "limit", "in": "query", "description": "The number of bucketed results to be returned (see `buckets`)", "required": false, "type": "integer", "format": "int32" }, { "name": "APIM-TenantUuid", "in": "header", "description": "The Portal tenant's UUID", "required": true, "type": "string" }, { "name": "APIM-OrgUuid", "in": "header", "description": "The organization's UUID", "required": false, "type": "string" } ], "responses": { "200": { "description": "Success", "schema": { "$ref": "#\/definitions\/ErrorsResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#\/definitions\/ExceptionResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#\/definitions\/ExceptionResponse" } } } } }, "\/errors\/{type}\/by-{timeAggregation}": { "get": { "tags": [ "errors" ], "summary": "Returns time-aggregated error metrics for APIs or applications", "operationId": "getErrorMetricsUsingGET", "description": "Returns a list of time-aggregated error metrics for APIs or applications.", "consumes": [ "application\/json" ], "produces": [ "application\/json" ], "parameters": [ { "name": "type", "in": "path", "description": "The type of construct to return error metrics for. Options are: `apis`, `apps`. Defaults to `apis`", "required": true, "type": "string", "default": "apis", "enum": [ "apis", "apps" ] }, { "name": "timeAggregation", "in": "path", "description": "The time aggregation unit to group the result set by. Options are: `hour`, `day`, `month`. Defaults to `hour`", "required": true, "type": "string", "default": "hour", "enum": [ "hour", "day", "month" ] }, { "name": "timerange", "in": "query", "description": "The request time period. Options are: `hour` (the last 60 minutes including the current minute), `day` (the last 24 hours including the current hour), `week` (the last 7 days including today), `month` (the last 30 days including today), `year` (the last 365 days including today), `custom` (requires `startDate` and `endDate` values). Defaults to `week`", "required": false, "type": "string", "default": "week", "enum": [ "hour", "day", "week", "month", "year", "custom" ] }, { "name": "startDate", "in": "query", "description": "The start date for the query in YYYY-MM-DD format. **Only** applicable to (and required if) `timerange=custom`. Will be converted to `startTimeGMT` in the response. Defaults to one week prior to the current GMT datetime on your local machine", "required": false, "type": "string" }, { "name": "endDate", "in": "query", "description": "The end date for the query in YYYY-MM-DD format. **Only** applicable to (and required if) `timerange=custom`. The `endDate` must be after the `startDate`. Will be converted to `endTimeGMT` in the response. Defaults to the current GMT datetime on your local machine", "required": false, "type": "string" }, { "name": "appIds", "in": "query", "description": "A comma separated list of applications IDs for which error metrics will be returned", "required": false, "type": "string" }, { "name": "apiIds", "in": "query", "description": "A comma separated list of API IDs for which error metrics will be returned", "required": false, "type": "string" }, { "name": "proxyIds", "in": "query", "description": "A comma separated list of proxy (API Gateway server) IDs for which error metrics will be returned", "required": false, "type": "string" }, { "name": "buckets", "in": "query", "description": "Lets you group the result set based on a certain type. Options are: `apis`, `apps`, `serviceErrors`, `policyErrors`, `methodType`", "required": false, "type": "string", "enum": [ "apis", "apps", "serviceErrors", "policyErrors", "methodType" ] }, { "name": "sortorder", "in": "query", "description": "Specifies the sort order for bucketed entries (see `buckets`). You **must** specify a field to sort by (see `sortby`). Allowed values are: `asc` (ascending), `desc` (descending). Defaults to `desc`", "required": false, "type": "string", "default": "desc", "enum": [ "desc", "asc" ] }, { "name": "sortby", "in": "query", "description": "Specifies the type of record to sort bucketed entries by (see `buckets`). You **must** specify the sort order (see `sortorder`). Allowed values are: `errors`, `errorrate`, `appName`, `apiName`. Defaults to `errors`" , "required": false, "type": "string", "default": "errors", "enum": [ "errors", "errorrate", "appName", "apiName" ] }, { "name": "limit", "in": "query", "description": "The number of bucketed results to be returned (see `buckets`)", "required": false, "type": "integer", "format": "int32" }, { "name": "APIM-TenantUuid", "in": "header", "description": "The Portal tenant's UUID", "required": true, "type": "string" }, { "name": "APIM-OrgUuid", "in": "header", "description": "The organization's UUID", "required": false, "type": "string" } ], "responses": { "200": { "description": "Success", "schema": { "$ref": "#\/definitions\/ErrorsResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#\/definitions\/ExceptionResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#\/definitions\/ExceptionResponse" } } } } }, "\/hits\/{type}": { "get": { "tags": [ "hits" ], "summary": "Returns hit metrics for APIs or applications", "operationId": "getHitMetricsUsingGET", "description": "Returns a list of hit metrics for APIs or applications.", "consumes": [ "application\/json" ], "produces": [ "application\/json" ], "parameters": [ { "name": "type", "in": "path", "description": "The type of construct to return hit metrics for. Options are: `apis`, `apps`. Defaults to `apis`", "required": true, "type": "string", "default": "apis", "enum": [ "apis", "apps" ] }, { "name": "timerange", "in": "query", "description": "The request time period. Options are: `hour` (the last 60 minutes including the current minute), `day` (the last 24 hours including the current hour), `week` (the last 7 days including today), `month` (the last 30 days including today), `year` (the last 365 days including today), `custom` (requires `startDate` and `endDate` values). Defaults to `week`", "required": false, "type": "string", "default": "week", "enum": [ "hour", "day", "week", "month", "year", "custom" ] }, { "name": "startDate", "in": "query", "description": "The start date for the query in YYYY-MM-DD format. **Only** applicable to (and required if) `timerange=custom`. Will be converted to `startTimeGMT` in the response. Defaults to one week prior to the current GMT datetime on your local machine", "required": false, "type": "string" }, { "name": "endDate", "in": "query", "description": "The end date for the query in YYYY-MM-DD format. **Only** applicable to (and required if) `timerange=custom`. The `endDate` must be after the `startDate`. Will be converted to `endTimeGMT` in the response. Defaults to the current GMT datetime on your local machine", "required": false, "type": "string" }, { "name": "appIds", "in": "query", "description": "A comma separated list of applications IDs for which hit metrics will be returned", "required": false, "type": "string" }, { "name": "apiIds", "in": "query", "description": "A comma separated list of API IDs for which hit metrics will be returned", "required": false, "type": "string" }, { "name": "proxyIds", "in": "query", "description": "A comma separated list of proxy (API Gateway server) IDs for which hit metrics will be returned", "required": false, "type": "string" }, { "name": "buckets", "in": "query", "description": "A comma separated list of constructs to group the result set by. Supported values are: `apis`, `apps`", "required": false, "type": "string" }, { "name": "sortorder", "in": "query", "description": "Specifies the sort order for bucketed entries (see `buckets`). You **must** specify a field to sort by (see `sortby`). Allowed values are: `asc` (ascending), `desc` (descending). Defaults to `desc`", "required": false, "type": "string", "default": "desc", "enum": [ "desc", "asc" ] }, { "name": "sortby", "in": "query", "description": "Specifies the type of record to sort bucketed entries by (see `buckets`). You **must** specify the sort order (see `sortorder`). Allowed values are: `date`, `hits`, `appName`, `apiName`. Defaults to `hits`", "required": false, "type": "string", "default": "hits", "enum": [ "date", "hits", "appName", "apiName" ] }, { "name": "limit", "in": "query", "description": "The number of bucketed results to be returned (see `buckets`)", "required": false, "type": "integer", "format": "int32" }, { "name": "APIM-TenantUuid", "in": "header", "description": "The Portal tenant's UUID", "required": true, "type": "string" }, { "name": "APIM-OrgUuid", "in": "header", "description": "The organization's UUID", "required": false, "type": "string" } ], "responses": { "200": { "description": "Success", "schema": { "$ref": "#\/definitions\/HitsResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#\/definitions\/ExceptionResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#\/definitions\/ExceptionResponse" } } } } }, "\/hits\/{type}\/by-{timeAggregation}": { "get": { "tags": [ "hits" ], "summary": "Returns time-aggregated hit metrics for APIs or applications", "operationId": "getHitMetricsByAggrUsingGET", "description": "Returns a list of time-aggregated hit metrics for APIs or applications.", "consumes": [ "application\/json" ], "produces": [ "application\/json" ], "parameters": [ { "name": "type", "in": "path", "description": "The type of construct to return hit metrics for. Options are: `apis`, `apps`. Defaults to `apis`", "required": true, "type": "string", "default": "apis", "enum": [ "apis", "apps" ] }, { "name": "timeAggregation", "in": "path", "description": "The time aggregation unit to group the result set by. Options are: `hour`, `day`, `month`. Defaults to `hour`", "required": true, "type": "string", "enum": [ "minute", "hour", "day", "month" ] }, { "name": "timerange", "in": "query", "description": "The request time period. Options are: `hour` (the last 60 minutes including the current minute), `day` (the last 24 hours including the current hour), `week` (the last 7 days including today), `month` (the last 30 days including today), `year` (the last 365 days including today), `custom` (requires `startDate` and `endDate` values). Defaults to `week`", "required": false, "type": "string", "default": "week", "enum": [ "hour", "day", "week", "month", "year", "custom" ] }, { "name": "startDate", "in": "query", "description": "The start date for the query in YYYY-MM-DD format. **Only** applicable to (and required if) `timerange=custom`. Will be converted to `startTimeGMT` in the response. Defaults to one week prior to the current GMT datetime on your local machine", "required": false, "type": "string" }, { "name": "endDate", "in": "query", "description": "The end date for the query in YYYY-MM-DD format. **Only** applicable to (and required if) `timerange=custom`. The `endDate` must be after the `startDate`. Will be converted to `endTimeGMT` in the response. Defaults to the current GMT datetime on your local machine", "required": false, "type": "string" }, { "name": "appIds", "in": "query", "description": "A comma separated list of applications IDs for which hit metrics will be returned", "required": false, "type": "string" }, { "name": "apiIds", "in": "query", "description": "A comma separated list of API IDs for which hit metrics will be returned", "required": false, "type": "string" }, { "name": "proxyIds", "in": "query", "description": "A comma separated list of proxy (API Gateway server) IDs for which error metrics will be returned", "required": false, "type": "string" }, { "name": "buckets", "in": "query", "description": "A comma separated list of constructs to group the result set by. Supported values are: `apis`, `apps`", "required": false, "type": "string" }, { "name": "sortorder", "in": "query", "description": "Specifies the sort order for bucketed entries (see `buckets`). You **must** specify a field to sort by (see `sortby`). Allowed values are: `asc` (ascending), `desc` (descending). Defaults to `desc`", "required": false, "type": "string", "default": "desc", "enum": [ "desc", "asc" ] }, { "name": "sortby", "in": "query", "description": "Specifies the type of record to sort bucketed entries by (see `buckets`). You **must** specify the sort order (see `sortorder`). Allowed values are: `date`, `hits`, `appName`, `apiName`. Defaults to `hits`", "required": false, "type": "string", "default": "hits", "enum": [ "date", "hits", "appName", "apiName" ] }, { "name": "limit", "in": "query", "description": "The number of bucketed results to be returned (see `buckets`)", "required": false, "type": "integer", "format": "int32" }, { "name": "APIM-TenantUuid", "in": "header", "description": "The Portal tenant's UUID", "required": true, "type": "string" }, { "name": "APIM-OrgUuid", "in": "header", "description": "The organization's UUID", "required": false, "type": "string" } ], "responses": { "200": { "description": "Success", "schema": { "$ref": "#\/definitions\/HitsResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#\/definitions\/ExceptionResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#\/definitions\/ExceptionResponse" } } } } }, "\/latency\/{type}": { "get": { "tags": [ "latency" ], "summary": "Returns latency metrics for APIs", "operationId": "getLatencyMetricsUsingGET", "description": "Returns a list of latency metrics for APIs.", "consumes": [ "application\/json" ], "produces": [ "application\/json" ], "parameters": [ { "name": "type", "in": "path", "description": "The type of construct to return latency metrics for. Only allowed for `apis`", "required": true, "type": "string", "default": "apis", "enum": [ "apis" ] }, { "name": "timerange", "in": "query", "description": "The request time period. Options are: `hour` (the last 60 minutes including the current minute), `day` (the last 24 hours including the current hour), `week` (the last 7 days including today), `month` (the last 30 days including today), `year` (the last 365 days including today), `custom` (requires `startDate` and `endDate` values). Defaults to `week`", "required": false, "type": "string", "default": "week", "enum": [ "hour", "day", "week", "month", "year", "custom" ] }, { "name": "startDate", "in": "query", "description": "The start date for the query in YYYY-MM-DD format. **Only** applicable to (and required if) `timerange=custom`. Will be converted to `startTimeGMT` in the response. Defaults to one week prior to the current GMT datetime on your local machine", "required": false, "type": "string" }, { "name": "endDate", "in": "query", "description": "The end date for the query in YYYY-MM-DD format. **Only** applicable to (and required if) `timerange=custom`. The `endDate` must be after the `startDate`. Will be converted to `endTimeGMT` in the response. Defaults to the current GMT datetime on your local machine", "required": false, "type": "string" }, { "name": "apiIds", "in": "query", "description": "A comma separated list of API IDs for which latency metrics will be returned", "required": false, "type": "string" }, { "name": "proxyIds", "in": "query", "description": "A comma separated list of proxy (API Gateway server) IDs for which latency metrics will be returned", "required": false, "type": "string" }, { "name": "buckets", "in": "query", "description": "Lets you group the result set by `apis`", "required": false, "type": "string" }, { "name": "sortorder", "in": "query", "description": "Specifies the sort order for bucketed entries (see `buckets`). You **must** specify a field to sort by (see `sortby`). Allowed values are: `asc` (ascending), `desc` (descending). Defaults to `desc`", "required": false, "type": "string", "default": "desc", "enum": [ "desc", "asc" ] }, { "name": "sortby", "in": "query", "description": "Specifies the type of record to sort bucketed entries by (see `buckets`). You **must** specify the sort order (see `sortorder`). Allowed values are: `date`, `hits`, `appName`, `apiName`. Defaults to `hits`", "required": false, "type": "string", "default": "hits", "enum": [ "date", "hits", "appName", "apiName" ] }, { "name": "limit", "in": "query", "description": "The number of bucketed results to be returned (see `buckets`)", "required": false, "type": "integer", "format": "int32" }, { "name": "stats", "in": "query", "description": "A comma separated list of statistical values. Allowed values are: `avg`, `min`, `max`", "required": false, "type": "string" }, { "name": "APIM-TenantUuid", "in": "header", "description": "The Portal tenant's UUID", "required": true, "type": "string" }, { "name": "APIM-OrgUuid", "in": "header", "description": "The organization's UUID", "required": false, "type": "string" } ], "responses": { "200": { "description": "Success", "schema": { "$ref": "#\/definitions\/HitsResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#\/definitions\/ExceptionResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#\/definitions\/ExceptionResponse" } } } } }, "\/latency\/{type}\/by-{timeAggregation}": { "get": { "tags": [ "latency" ], "summary": "Returns time-aggregated latency metrics for APIs", "operationId": "getLatencyMetricsByAggrUsingGET", "description": "Returns a time-aggregated list of latency metrics for APIs.", "consumes": [ "application\/json" ], "produces": [ "application\/json" ], "parameters": [ { "name": "type", "in": "path", "description": "The type of construct to return latency metrics for. Only allowed for `apis`", "required": true, "type": "string", "default": "apis", "enum": [ "apis" ] }, { "name": "timeAggregation", "in": "path", "description": "The time aggregation unit to group the result set by. Options are: `hour`, `day`, `month`, `hod` (hour of day), `dow` (day of week). Defaults to `hour`", "required": true, "type": "string", "default": "hour", "enum": [ "hour", "day", "month", "hod", "dow" ] }, { "name": "timerange", "in": "query", "description": "The request time period. Options are: `hour` (the last 60 minutes including the current minute), `day` (the last 24 hours including the current hour), `week` (the last 7 days including today), `month` (the last 30 days including today), `year` (the last 365 days including today), `custom` (requires `startDate` and `endDate` values). Defaults to `week`", "required": false, "type": "string", "default": "week", "enum": [ "hour", "day", "week", "month", "year", "custom" ] }, { "name": "startDate", "in": "query", "description": "The start date for the query in YYYY-MM-DD format. **Only** applicable to (and required if) `timerange=custom`. Will be converted to `startTimeGMT` in the response. Defaults to one week prior to the current GMT datetime on your local machine", "required": false, "type": "string" }, { "name": "endDate", "in": "query", "description": "The end date for the query in YYYY-MM-DD format. **Only** applicable to (and required if) `timerange=custom`. The `endDate` must be after the `startDate`. Will be converted to `endTimeGMT` in the response. Defaults to the current GMT datetime on your local machine", "required": false, "type": "string" }, { "name": "apiIds", "in": "query", "description": "A comma separated list of API IDs for which latency metrics will be returned", "required": false, "type": "string" }, { "name": "proxyIds", "in": "query", "description": "A comma separated list of proxy (API Gateway server) IDs for which latency metrics will be returned", "required": false, "type": "string" }, { "name": "buckets", "in": "query", "description": "Lets you group the result set by `apis`", "required": false, "type": "string" }, { "name": "sortorder", "in": "query", "description": "Specifies the sort order for bucketed entries (see `buckets`). You **must** specify a field to sort by (see `sortby`). Allowed values are: `asc` (ascending), `desc` (descending). Defaults to `desc`", "required": false, "type": "string", "default": "desc", "enum": [ "desc", "asc" ] }, { "name": "sortby", "in": "query", "description": "Specifies the type of record to sort bucketed entries by (see `buckets`). You **must** specify the sort order (see `sortorder`). Allowed values are: `date`, `hits`, `appName`, `apiName`. Defaults to `hits`", "required": false, "type": "string", "default": "hits", "enum": [ "date", "hits", "appName", "apiName" ] }, { "name": "limit", "in": "query", "description": "The number of bucketed results to be returned (see `buckets`)", "required": false, "type": "integer", "format": "int32" }, { "name": "stats", "in": "query", "description": "A comma separated list of statistical values. Allowed values are: `avg`, `min`, `max`", "required": false, "type": "string" }, { "name": "APIM-TenantUuid", "in": "header", "description": "The Portal tenant's UUID", "required": true, "type": "string" }, { "name": "APIM-OrgUuid", "in": "header", "description": "The organization's UUID", "required": false, "type": "string" } ], "responses": { "200": { "description": "Success", "schema": { "$ref": "#\/definitions\/HitsResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#\/definitions\/ExceptionResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#\/definitions\/ExceptionResponse" } } } } }, "\/usage\/{type}\/plan": { "get": { "tags": [ "usage" ], "summary": "Returns usage metrics for an organization", "operationId": "getOrgUsageMetricsUsingGET", "description": "Returns a list of usage metrics for an organization as per its account plan.", "consumes": [ "application\/json" ], "produces": [ "application\/json" ], "parameters": [ { "name": "type", "in": "path", "description": "The type of construct to return usage metrics for. Allowed value is: `orgs` (organizations)", "required": true, "type": "string", "default": "orgs", "enum": [ "orgs" ] }, { "name": "planType", "in": "query", "description": "The plan type. Allowed values are: `daily`, `monthly`", "required": false, "type": "string", "default": "monthly", "enum": [ "daily", "monthly" ] }, { "name": "timerange", "in": "query", "description": "The request time period. Should **only** be used with `planType=monthly`. Options are: `day` (the last 24 hours including the current hour), `week` (the last 7 days including today), `month` (the last 30 days including today). Defaults to `week`", "required": false, "type": "string", "default": "week", "enum": [ "week", "day", "month" ] }, { "name": "orgIds", "in": "query", "description": "A comma seperated list of organization UUIDs", "required": false, "type": "string" }, { "name": "sortorder", "in": "query", "description": "Specifies the sort order for the result set. You **must** specify a field to sort by (see `sortby`). Allowed values are: `asc` (ascending), `desc` (descending). Defaults to `desc`", "required": false, "type": "string", "default": "desc", "enum": [ "desc", "asc" ] }, { "name": "sortby", "in": "query", "description": "Specifies the type of record to sort the result set by. You **must** specify the sort order (see `sortorder`). Allowed values are: `usage`, `orgName` (organization name), `orgId` (organization ID). Defaults to `usage`", "required": false, "type": "string", "default": "usage", "enum": [ "usage", "orgName", "orgId" ] }, { "name": "limit", "in": "query", "description": "The number of records that will be returned per call", "required": false, "type": "integer", "format": "int32" }, { "name": "APIM-TenantUuid", "in": "header", "description": "The Portal tenant's UUID", "required": true, "type": "string" }, { "name": "APIM-OrgUuid", "in": "header", "description": "The organization's UUID", "required": false, "type": "string" } ], "responses": { "200": { "description": "Success", "schema": { "$ref": "#\/definitions\/UsagesResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#\/definitions\/ExceptionResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#\/definitions\/ExceptionResponse" } } } } } }, "definitions": { "Hits": { "type": "object", "properties": { "buckets": { "type": "array", "items": { "$ref": "#\/definitions\/HitsBucket" } }, "hits": { "type": "integer", "format": "int64" } } }, "ErrorsResponse": { "type": "object", "properties": { "data": { "$ref": "#\/definitions\/Errors" }, "query": { "$ref": "#\/definitions\/ErrorsRequestParams" }, "requestId": { "type": "string" }, "respCode": { "type": "integer", "format": "int32" }, "respMsg": { "type": "string" } } }, "LatencyRequestParams": { "type": "object", "properties": { "apiIds": { "type": "string" }, "buckets": { "type": "string" }, "endTimeGMT": { "type": "string" }, "limit": { "type": "string" }, "proxyIds": { "type": "string" }, "sortby": { "type": "string" }, "sortorder": { "type": "string" }, "startTimeGMT": { "type": "string" }, "stats": { "type": "string" }, "timerange": { "type": "string" } } }, "HitsBucket": { "type": "object", "properties": { "apiId": { "type": "string" }, "apiName": { "type": "string" }, "appId": { "type": "string" }, "appName": { "type": "string" }, "hits": { "type": "integer", "format": "int64" } } }, "HitsTsEntry": { "type": "object", "properties": { "hits": { "$ref": "#\/definitions\/Hits" }, "hitsTs": { "type": "array", "items": { "$ref": "#\/definitions\/HitsTs" } } } }, "ErrorsTsResponse": { "type": "object", "properties": { "data": { "$ref": "#\/definitions\/ErrorsTsEntry" }, "query": { "$ref": "#\/definitions\/ErrorsRequestParams" }, "requestId": { "type": "string" }, "respCode": { "type": "integer", "format": "int32" }, "respMsg": { "type": "string" } } }, "ErrorsRequestParams": { "type": "object", "properties": { "apiIds": { "type": "string" }, "appIds": { "type": "string" }, "buckets": { "type": "string" }, "endTimeGMT": { "type": "string" }, "limit": { "type": "string" }, "proxyIds": { "type": "string" }, "sortby": { "type": "string" }, "sortorder": { "type": "string" }, "startTimeGMT": { "type": "string" }, "timerange": { "type": "string" } } }, "UsageRequestParams": { "type": "object", "properties": { "endTimeGMT": { "type": "string" }, "limit": { "type": "string" }, "orgIds": { "type": "string" }, "planType": { "type": "string" }, "sortby": { "type": "string" }, "sortorder": { "type": "string" }, "startTimeGMT": { "type": "string" }, "timerange": { "type": "string" } } }, "LatenciesTsResponse": { "type": "object", "properties": { "data": { "$ref": "#\/definitions\/LatenciesTsEntry" }, "query": { "$ref": "#\/definitions\/LatencyRequestParams" }, "requestId": { "type": "string" }, "respCode": { "type": "integer", "format": "int32" }, "respMsg": { "type": "string" } } }, "HitsResponse": { "type": "object", "properties": { "data": { "$ref": "#\/definitions\/Hits" }, "query": { "$ref": "#\/definitions\/HitsRequestParams" }, "requestId": { "type": "string" }, "respCode": { "type": "integer", "format": "int32" }, "respMsg": { "type": "string" } } }, "ErrorsBucket": { "type": "object", "properties": { "apiId": { "type": "string" }, "apiName": { "type": "string" }, "appId": { "type": "string" }, "appName": { "type": "string" }, "authorizedFlag": { "type": "boolean" }, "errorDist": { "type": "number", "format": "double" }, "errors": { "type": "integer", "format": "int64" }, "methodType": { "type": "string" }, "respCode": { "type": "integer", "format": "int32" } } }, "LatenciesTsEntry": { "type": "object", "properties": { "latencies": { "$ref": "#\/definitions\/Latencies" }, "latenciesTs": { "type": "array", "items": { "$ref": "#\/definitions\/LatenciesTs" } } } }, "HitsTsResponse": { "type": "object", "properties": { "data": { "$ref": "#\/definitions\/HitsTsEntry" }, "query": { "$ref": "#\/definitions\/HitsRequestParams" }, "requestId": { "type": "string" }, "respCode": { "type": "integer", "format": "int32" }, "respMsg": { "type": "string" } } }, "Usage": { "type": "object", "properties": { "orgId": { "type": "string" }, "orgName": { "type": "string" }, "usage": { "type": "number", "format": "double" } } }, "ExceptionResponse": { "type": "object", "properties": { "query": { "type": "object" }, "requestId": { "type": "string" }, "respCode": { "type": "integer", "format": "int32" }, "respMsg": { "type": "string" } } }, "HitsTs": { "type": "object", "properties": { "buckets": { "type": "array", "items": { "$ref": "#\/definitions\/HitsBucket" } }, "date": { "type": "string" }, "hits": { "type": "integer", "format": "int64" } } }, "LatenciesBucket": { "type": "object", "properties": { "apiId": { "type": "string" }, "apiName": { "type": "string" }, "avg": { "type": "number", "format": "double" }, "max": { "type": "number", "format": "double" }, "min": { "type": "number", "format": "double" } } }, "LatenciesResponse": { "type": "object", "properties": { "data": { "$ref": "#\/definitions\/Latencies" }, "query": { "$ref": "#\/definitions\/LatencyRequestParams" }, "requestId": { "type": "string" }, "respCode": { "type": "integer", "format": "int32" }, "respMsg": { "type": "string" } } }, "ErrorsTsEntry": { "type": "object", "properties": { "errors": { "$ref": "#\/definitions\/Errors" }, "errorsTs": { "type": "array", "items": { "$ref": "#\/definitions\/ErrorsTs" } } } }, "UsagesResponse": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#\/definitions\/Usage" } }, "query": { "$ref": "#\/definitions\/UsageRequestParams" }, "requestId": { "type": "string" }, "respCode": { "type": "integer", "format": "int32" }, "respMsg": { "type": "string" } } }, "Errors": { "type": "object", "properties": { "buckets": { "type": "array", "items": { "$ref": "#\/definitions\/ErrorsBucket" } }, "errorRate": { "type": "number", "format": "double" }, "errors": { "type": "integer", "format": "int64" } } }, "HitsRequestParams": { "type": "object", "properties": { "apiIds": { "type": "string" }, "appIds": { "type": "string" }, "buckets": { "type": "string" }, "endTimeGMT": { "type": "string" }, "limit": { "type": "string" }, "proxyIds": { "type": "string" }, "sortby": { "type": "string" }, "sortorder": { "type": "string" }, "startTimeGMT": { "type": "string" }, "timerange": { "type": "string" } } }, "Latencies": { "type": "object", "properties": { "avg": { "type": "number", "format": "double" }, "buckets": { "type": "array", "items": { "$ref": "#\/definitions\/LatenciesBucket" } }, "max": { "type": "number", "format": "double" }, "min": { "type": "number", "format": "double" } } }, "ErrorsTs": { "type": "object", "properties": { "buckets": { "type": "array", "items": { "$ref": "#\/definitions\/ErrorsBucket" } }, "date": { "type": "string" }, "errorRate": { "type": "number", "format": "double" }, "errors": { "type": "integer", "format": "int64" } } }, "LatenciesTs": { "type": "object", "properties": { "avg": { "type": "number", "format": "double" }, "buckets": { "type": "array", "items": { "$ref": "#\/definitions\/LatenciesBucket" } }, "date": { "type": "string" }, "max": { "type": "number", "format": "double" }, "min": { "type": "number", "format": "double" } } } } }