GET /api/businesses/{BusinessID}/metrics
Returns a set of metric information for the specified business organization, in JSON or XML format, that can be used to create a chart.
Authorization Roles/Permissions: Must be logged in. Must have visibility of the business organization.
This topic includes the following sections:
HTTP Method
GET
URL
https://{hostname}/api/businesses/{BusinessID}/metrics[?][BusinessID={BusinessID}]&[ReportType={ReportType}] &[Environment={Environment}]&[StartDate={StartDate}]&[EndDate={EndDate}]&[TimeZone={TimeZone}] &[TimeInterval={TimeInterval}]&[Duration={Duration}]&[ShowSummary={ShowSummary}]&[ShowSLAs={ShowSLAs}]
Sample Request
The example below shows a request for metric information for the specified business organization.
Sample Request URL
https://{hostname}/api/businesses/640bf91c-9f86-4ff0-8532-8d2b33b3b594.acmepaymentscorp/metrics ?TimeInterval=15m&Duration=all&Environment=All&ReportType=business.top10.apis
Sample request headers
Accept: application/json X-Csrf-Token_acmepaymentscorp: TokenID%3D8ed70a13-8469-11e8-b37a-b155e4eabeb8%2CexpirationTime%3D153...
Sample request body
Not applicable.
Request Headers
For general information on request header values, refer to HTTP Request Headers.
Header | Description |
---|---|
Accept | application/json, text/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, application/vnd.soa.v81+json, application/vnd.soa.v81+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 |
---|---|---|---|---|
BusinessID | Path | string | Required | The unique ID for a specific business organization on the platform. |
ReportType | Query | string | Optional | The type of metric information. For valid values, see ReportType. |
Environment | Query | string | Optional | The environment (implementation) (Sandbox or Production). If not specified, defaults to Production. |
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. |
ShowSLAs | Query | boolean | Optional | Indicates whether SLAs should be included in the information returned. If not specified, defaults to false, meaning that SLAs are not returned. |
Response
If successful, this operation returns HTTP status code 200, with the metrics for the specified business organization in JSON or XML format.
Sample Response
The sample response below shows successful completion of this operation.
Sample response headers
cache-control: no-cache, no-store Content-Type: application/json Date: Tue, 10 Jul 2018 18:01:42 GMT
Sample response body
{ "EndTime":"2018-07-10T18:15:00Z",<pre class="pre_headers_response"> "Interval":[ { "Metric":[ { "Name":"Calendar (v1)", "Key":"2c2ad8ff-593b-4b18-baf8-24da5b3bd0aa.bdn", "Value":21 }, { "Name":"Clarify (v1)", "Key":"902c9e45-f96c-4fc4-ace0-c3f38a1c55b2.bdn", "Value":54 }, { "Name":"Properties_v2_Service (v1)", "Key":"2728e994-c0f3-49a3-bb0b-b5a1fce874f0.bdn", "Value":41 }, { "Name":"Swagger_Petstore (v1)", "Key":"b878f43d-6834-480e-9e48-947746afe9e9.bdn", "Value":88 }, { "Name":"Comments (v1)", "Key":"692c2213-92ae-430e-96d1-63c4c45c7ffd.bdn", "Value":46 }, { "Name":"ATMS (v1)", "Key":"1d63052e-a52b-4e56-9178-7494924acc92.bdn", "Value":203 }, { "Name":"Posts (v1)", "Key":"a6415fg5-bd80-56a1-ab89-db68f556e5as.bdn", "Value":9 } ] } ] }
Response Headers
For general information on response header values, refer to HTTP Response Headers.
Header | Description |
---|---|
Content-Type | application/json, text/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, application/vnd.soa.v81+json, application/vnd.soa.v81+xml |
Response Body
Name | Type | Description |
---|---|---|
Graph | Graph |
Contains metric information. Response includes End Time and Interval. |
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 |
---|---|
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. |
400 | Returned if the client sends invalid parameters or body content. For example, you might get this response if there is a typo in the request URL. |
500 | An error occurred processing the call. |
More information about Akana API Platform API error messages.