GET /api/apis/versions/{APIVersionID}/environments/{Environment}/operations/{OperationName}/metrics

Returns a set of metric information for the specified operation in the specified environment that can be used to create a chart.

For additional information regarding the set of operations dealing with metric information, see Metrics on the Platform.

Note: This operation returns metric data per operation as a chart; the GET /api/apis/versions/{APIVersionID}/environments/{Env}/operations/{OpName}/txlogs operation returns the same data as a table.

Authorization Roles/Permissions: Must be logged in. Must be a user with Monitor permission for the API; an API Admin or Business Admin or an app developer who has a contract with the API.

This topic includes the following sections:

HTTP Method

GET

URL

https://{hostname}/api/apis/versions/{APIVersionID}/environments/{Environment}/operations/{OperationName}/metrics

Sample Request

The example below shows a request for the metric information for the specified API version.

Sample Request URL

https://{hostname}/api/apis/versions/0f14e2b3-671a-49e4-98ac-eef610a58a81.acmepaymentscorp/environments/Production/operations/getPetById/metrics

Sample request headers

Accept: application/json

Sample request body

Not applicable.

Request Headers

For general information on request header values, refer to HTTP Request Headers.

Header Description
Accept

application/json, application/xml

application/vnd.soa.v71+json, application/vnd.soa.v71+xml

application/vnd.soa.v72+json, application/vnd.soa.v72+xml

application/vnd.soa.v80+json, application/vnd.soa.v80+xml

Cookie AtmoAuthToken_{fedmemberid}={cookie value, which usually starts with TokenID}—The platform cookie. This is the Akana API Platform authorization token, and must be sent with every API request that requires login. For more information and an example, see Session cookies.
X-Csrf-Token_{fedmemberID} The CSRF prevention header; may or may not be required, depending on platform settings. See CSRF Prevention on the Platform. By default, the CSRF header is not required for GET operations and is required for all others, with a few exceptions relating to user login.

Request Parameters

Parameter Parm Type Data Type Required Description
APIVersionID Path string Required The unique ID for a specific API version.
Environment Path string Required The environment (implementation) (Sandbox or Production).
OperationName Path string Required The specific operation for which metrics should be returned.
StartDate Query string Required The beginning point for the date range of metric information requested. Format: YYYY-MM-DD:THH:MM:SS. Example: StartDate=2011-01-01T11:55:22. If StartDate is not specified, the operation uses EndDate minus Duration. If both StartDate and EndDate are unspecified, the operation returns information for the Duration value, and if Duration is also unspecified it returns default Duration value of 2 hours.
EndDate Query string Optional The ending point for the date range of metric information requested. Format: YYYY-MM-DD:THH:MM:SS. Example: EndDate=2011-01-02T11:55:22. If not specified, defaults to the current date/time of the API call.
TimeZone Query string Optional The time zone for the information. If a time zone isn't specified, the information is returned in GMT. For more information, refer to Working with Time Zones and Time Intervals.
TimeInterval Query string Optional The time interval for the metric information to be returned. For example, you might want data points every 10 seconds. If not specified, defaults to five-second intervals (5s). The StartDate, EndDate, and Duration fields work together to define the information to be returned; the TimeInterval determines the data points. For more information, refer to Working with Time Zones and Time Intervals.
Duration Query string Optional The duration for the metric information. For example, you might want metric information for a 24-hour period or only for an hour. The StartDate, EndDate, and Duration fields work together to define the information to be returned. If not specified, defaults to two hours (2h).
ShowSummary Query boolean Optional

Indicates whether a summary of the metric information should be included in the information returned. For example, if the metric information includes daily metrics for 7 days, the summary would include one set of totals. If not specified, this defaults to false, meaning that no summary is included.

If a summary is requested, it is expressed as a single metric for the entire duration. For example, if daily data for the year is requested, there are 365 points, and the summary is a total.

ShowIntervalData Query boolean Optional Indicates whether the metric information that's returned should be broken up by time interval. For example, if the TimeInterval value is five minutes (5m) and the Duration value is one hour (1h), and ShowIntervalData is set to true, the results would include 12 sets of information, one for each five-minute interval. Time interval data can be used to create a bar chart.

Response

If successful, this operation returns HTTP status code 200, with the metrics for the specified API version in JSON or XML format.

Sample Response

The sample response below shows successful completion of this operation.

Sample response headers: application/json

Status Code: 200 OK
Content-Type: application/json
Date: Wed, 30 Dec 2015 17:37:20 GMT

Sample response body: application/json

{
  "StartTime" : "2015-12-30T15:37:25Z",
  "EndTime" : "2015-12-30T17:37:25Z",
  "Interval" : [ {
    "Metric" : [ {
      "Name" : "avgResponseTime",
      "Value" : 1272
    }, {
      "Name" : "minResponseTime",
      "Value" : 1272
    }, {
      "Name" : "maxResponseTime",
      "Value" : 1272
    }, {
      "Name" : "totalCount",
      "Value" : 1
    }, {
      "Name" : "successCount",
      "Value" : 1
    }, {
      "Name" : "faultCount",
      "Value" : 0
    } ],
    "StartTime" : "2015-12-30T17:28:40Z"
  }, {
    "Metric" : [ {
      "Name" : "avgResponseTime",
      "Value" : 254
    }, {
      "Name" : "minResponseTime",
      "Value" : 254
    }, {
      "Name" : "maxResponseTime",
      "Value" : 254
    }, {
      "Name" : "totalCount",
      "Value" : 1
    }, {
      "Name" : "successCount",
      "Value" : 1
    }, {
      "Name" : "faultCount",
      "Value" : 0
    } ],
    "StartTime" : "2015-12-30T17:36:55Z"
  } ]
}

Sample response headers: application/vnd.soa.v80+xml

Status Code: 200 OK
Content-Type: application/vnd.soa.v80+xml
Date: Wed, 30 Dec 2015 17:39:14 GMT

Sample response body: application/vnd.soa.v80+xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Graph xmlns="http://soa.com/xsd/performance/1.0" xmlns:ns2="http://soa.com/xsd/business/1.0" 
xmlns:ns3="http://soa.com/xsd/legals/1.0" xmlns:ns4="http://soa.com/xsd/dnmodel/1.0" 
xmlns:ns5="http://soa.com/xsd/api/1.0" xmlns:ns6="http://soa.com/xsd/resource/1.0" 
xmlns:ns7="http://soa.com/xsd/app/1.0" xmlns:ns8="http://soa.com/xsd/contract/1.0">
  <StartTime>2015-12-30T15:39:15Z</StartTime>
  <EndTime>2015-12-30T17:39:15Z</EndTime>
  <Interval StartTime="2015-12-30T17:28:40Z">
    <Metric>
      <Name>avgResponseTime</Name>
      <Value>1272</Value>
    </Metric>
    <Metric>
      <Name>minResponseTime</Name>
      <Value>1272</Value>
    </Metric>
    <Metric>
      <Name>maxResponseTime</Name>
      <Value>1272</Value>
    </Metric>
    <Metric>
      <Name>totalCount</Name>
      <Value>1</Value>
    </Metric>
    <Metric>
      <Name>successCount</Name>
      <Value>1</Value>
    </Metric>
    <Metric>
      <Name>faultCount</Name>
      <Value>0</Value>
    </Metric>
  </Interval>
  <Interval StartTime="2015-12-30T17:36:55Z">
    <Metric>
      <Name>avgResponseTime</Name>
      <Value>254</Value>
    </Metric>
    <Metric>
      <Name>minResponseTime</Name>
      <Value>254</Value>
    </Metric>
    <Metric>
      <Name>maxResponseTime</Name>
      <Value>254</Value>
    </Metric>
    <Metric>
      <Name>totalCount</Name>
      <Value>1</Value>
    </Metric>
    <Metric>
      <Name>successCount</Name>
      <Value>1</Value>
    </Metric>
    <Metric>
      <Name>faultCount</Name>
      <Value>0</Value>
    </Metric>
  </Interval>
</Graph>

Response Headers

For general information on response header values, refer to HTTP Response Headers.

Header Description
Content-Type

application/json, application/xml

application/vnd.soa.v71+json, application/vnd.soa.v71+xml

application/vnd.soa.v72+json, application/vnd.soa.v72+xml

application/vnd.soa.v80+json, application/vnd.soa.v80+xml

Response Body

Name Type Description
Graph Graph Contains metric information.

Error Codes/Messages

If the call is unsuccessful an error code/message is returned. One or more examples of possible errors for this operation are shown below.

Item Value
400 Bad request: Returned if the client sends a malformed request; for example, invalid parameters or body content.For example, you might get this response if you have an incorrect APIVersionID in the URL.
401 Unauthorized. For example, you would get this response if you didn't include the custom X-Csrf-Token_{fedmemberID} header in the request, when it was required by the platform settings; or if you included an invalid or expired value for this header. You would also get this response for any operation that requires login (almost all) if the login cookie was missing.
500 An error occurred processing the call.

More information about Akana API Platform API error messages.